Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- add_filter( 'upload_mimes', 'wpse_mime_types_webp' );
- function wpse_mime_types_webp( $mimes ) {
- $mimes['webp'] = 'image/webp';
- return $mimes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement