Stai provando a caricare sul tuo sito WordPress delle immagini in formato WEBp ma il sistema ti segnala l’errore “formato non supportato” ?
Risolvere questo problema è semplice, possiamo farlo usando un Plugin o inserendo manualmente alcune righe di codice al file function.php
Come plugin ti consiglio Allow Webp image, puoi scaricarlo qui: https://it.wordpress.org/plugins/allow-webp-image/
Per abilitare le immagini tramite function.php bisogna aggiungere 2 funzioni, una per abilitare i WEBp e l’altra per abilitare l’estensione.
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; }