1//Erlaubt den WebP Upload in WordPress - Code in die functions.php
2//Allows WebP upload to WordPress - Code goes to functions.php
3add_filter( 'wp_check_filetype_and_ext', 'wpse_file_and_ext_webp', 10, 4 );
4function wpse_file_and_ext_webp( $types, $file, $filename, $mimes ) {
5 if ( false !== strpos( $filename, '.webp' ) ) {
6 $types['ext'] = 'webp';
7 $types['type'] = 'image/webp';
8 }
9 return $types;
10}
11add_filter( 'upload_mimes', 'wpse_mime_types_webp' );
12function wpse_mime_types_webp( $mimes ) {
13 $mimes['webp'] = 'image/webp';
14 return $mimes;
15}