Blogging

How To Upload WebP Image In WordPress (Without Plugin)

How To Upload WebP Image In WordPress (With/Without Plugin). Today I am talking about how can I upload a WebP image on my WordPress website. Every newbie people can’t upload WebP to a WordPress website. WebP is an image format like jpg, jpeg, png, etc. So today we will learn how to convert your JPG and PNG image files to WebP files. 

How To Upload WebP Image In WordPress (With/Without Plugin)

Google recently launched a new image file format called WebP. WebP is a next-generation system, it reduces 35% smaller image files in size without decreasing any quality. Google suggests using this file format to speed up your website, but the difficulty is that we are unable to upload webpage image files to WordPress. A huge number of bloggers are using WordPress. Here is the solution to Upload WebP images in WordPress (With/Without Plugin).

WordPress does not support uploading WebP images by default. But you can easily upload WebP images to WordPress by using a plugin or some code. Here I will share with you both systems like plugin and code. You can use code or both as you wish.

WebP Image File Format Details

Google developed this WebP image format, WebP format was first announced on 30 September 2010 as a new open standard for lossy compressed true-color graphics on the web, producing smaller files of similar image quality to the JPG, JPEG, PNG scheme.

Add this below-given code to your theme functions (functions.php)

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’ );

Add the below-given code to your theme functions (functions.php) to preview webp images on your media library

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

Step by step To Upload Webp image files in WordPress without a plugin:

  1. Log in to your WordPress admin area
  2. Then click Appearance
  3.  then go to Theme Editor
  4. Now select Theme Functions [ functions.php]
  5. Copy and Paste this below-given Code and click on the update file
  6. Now you will be upload WebP files to your WordPress website

It is the best way to make this without a plugin. So if you think it’s easy for you then you must do it.

Ron Madelyn

Nice to meet you. I am working as a professional blog writer. I am writing tech-related issues Solutions. I help young hustler build their own online business.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button