How to upload webp image in WordPress without plugin

Upload webp image in WordPress without using a plugin

If you enable to upload webp images on your WordPress website then maybe your website is running on the old version of WordPress therefore if possible then update your WordPress version or you can’t update then don’t worry because in this post we are going to see the alternative and simple ways for upload webp image in WordPress with or without a plugin. If you want to make it very easy then you can use plugins and for that, you need to know about the best webp converter wordpress plugin.

In this video, we are going to see three methods for uploading the webp images but mainly focus on the allow webp images wordpress without a plugin. This type of problem occurs on the old version of WordPress. If you are watching this video then defiantly you are using old WordPress but why are you worried watch this video properly and you will get a solution for how to enable webp in WordPress.

Most people don’t know about WordPress converting images to webp but the answer is yes! If you install the WordPress webp plugin then that plugin will automatically convert your images from jpg, png to webp. I hope you enjoy this video if you have any queries then comment to us.

upload webp image in WordPress without plugin

Source code for upload webp image in WordPress without plugin

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 / thumbnail 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);

Note: If you want to download this source code then the "Download Link" is given below.

upload webp image in wordpress

DOWNLOAD


Once you download the source code after that follow the given steps in the video, The video is given below. I hope you will solve your problem easily. If you have any queries regarding this post or video then you can also comment to us.



If you like this trick then you can like and subscribe to our YouTube channel or share this trick with your friends.

Post a Comment

0 Comments