In this tutorial, you will learn “How to Upload Webp Images on WordPress Just in 2 Minutes”
If you have uploaded webp images on your website then surely you faced an issue “Sorry, this file type is not permitted for security reasons.”
You face this error because by default WordPress doesn’t support webp image format. But you can upload webp images on WordPress by using many tricks.
Webp is the modern image format. As you know website speed has a direct impact on website ranking and customer experience. Webp is the smallest image file format. You can use webp images to speed your website without losing quality.
Here in this article/video, you will learn how to upload webp images on wordpress without using any plugin. It’s completely free and you can do this in just 2 minutes.
3 Steps to Upload Webp Image Files on WordPress:
Find the code below in the article and copy that code.
//** * upload webp images.*/
function webp_upload_mimes( $existing_mimes ) {
// add webp to the list of mime types
$existing_mimes['webp'] = 'image/webp';
// return the array back to the function with our added mime type
return $existing_mimes;
}
add_filter( 'mime_types', 'webp_upload_mimes' );
//** * Enable preview for webp image files.*/
function webp_is_displayable($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', 'webp_is_displayable', 10, 2);
Sir namaste mara naam suraj hela ha Kolkata west Bengal say hu mara business ha home cleaning Services kitchen cleaning bedroom cleaning Services leads poblam ha please sir half me 8617239627 coll WhatsApp