I have no luck, actual wp version, plugins are updated have PHP version 8.2.
Added htaccess rules to convert images to webp and add a webp plugin, then upload an image to a new post, nothing chaged.
Check the page with browser right click inspector rool- all images are same in png or jkpg not in webp.
In inspecttor tool the image showed as resized, but in google insight it shows not resized .....what's wrong here with the endless wordpress construction looop ....?
No matter which plugin I use my images not convert to webp. Have a neve theme with card block demo content , may be the card block is the issue ?
What is wrong ? Must I activate an PHP extension in cpanel or something ?
Now added this code to themes function.php= no luck nothing changed
function add_custom_upload_mimes( $mimes_types ) {
$mimes_types['webp'] = 'image/webp'; // webp files
return $mimes_types;
}
add_filter( 'upload_mimes', 'add_custom_upload_mimes' );
function add_allow_upload_extension_exception( $types, $file, $filename, $mimes ) {
// Do basic extension validation and MIME mapping
$wp_filetype = wp_check_filetype( $filename, $mimes );
$ext = $wp_filetype['ext'];
$type = $wp_filetype['type'];
if( in_array( $ext, array( 'webp' ) ) ) { // if follows webp files have
$types['ext'] = $ext;
$types['type'] = $type;
}
return $types;
}
add_filter( 'wp_check_filetype_and_ext', 'add_allow_upload_extension_exception', 99, 4 );
function displayable_image_webp( $result, $path ) {
if ($result === false) {
$displayable_image_types = array( IMAGETYPE_WEBP );
$info = @getimagesize( $path );
if (empty($info)) {
$result = false;
} elseif (!in_array($info[2], $displayable_image_types)) {
$result = false;
} else {
$result = true;
}
}
return $result;
}
add_filter( 'file_is_displayable_image', 'displayable_image_webp', 10, 2 );
Any tips ?