/* Allow Post Thumbnails */ add_theme_support('post-thumbnails'); /** * Sets the extension and mime type for .webp files. * * @param array $wp_check_filetype_and_ext File data array containing 'ext', 'type', and * 'proper_filename' keys. * @param string $file Full path to the file. * @param string $filename The name of the file (may differ from $file due to * $file being in a tmp directory). * @param array $mimes Key is the file extension with value as the mime type. */ add_filter('wp_check_filetype_and_ext', 'wpse_file_and_ext_webp', 10, 4); function wpse_file_and_ext_webp($types, $file, $filename, $mimes) { if (false !== strpos($filename, '.webp')) { $types['ext'] = 'webp'; $types['type'] = 'image/webp'; } return $types; } /* Allow SVG Uploading */ function bheku_alow_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; $mimes['webp'] = 'image/webp'; return $mimes; }; add_filter('upload_mimes', 'bheku_alow_mime_types');