How To Upload WebP Images in WordPress

When you try to upload WebP image file format to your WordPress website, It shows you an error message ”Sorry, this file type is not permitted for security reasons”. In this article I will show you, how you can upload webp image files in your WordPress website.

How To Upload WebP Images in WordPress

By default WordPress does not allow you to upload webp image files, if you want to upload webp image files to WordPress then follow these steps below to know how to upload webp images to WordPress.

  1. Log in to your WordPress admin panel.
  2. Go to Appearance Theme Editor.
  3. At the right Select the Current theme that you are using.
  4. Then, Theme Functions [ functions.php ]
  5. Copy the code given below and Paste in this function.php and click on update file.
  6. You are done, now you will be upload WebP files to your WordPress website.
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);

Upload WebP images in WordPress using Plugin

You can also upload webp images to your wordpress website by the help of a plugin. Go to your WordPress plugin library and search “Allow webp image”. Install and activate this plugin After installing and activating this plugin you will be able to upload webp image files to WordPress website.

What is WebP image Format

WebP is an image file format that contains both lossless and lossy compression. This is a next-generation image format and it was developed by Google. Using WebP format image, webmasters and web developers can create smaller, richer images that make the website faster.

WebP image format file compresses images to 26% smaller in size compared to PNG and 25-34% smaller in size as compared to JPEG image format. This image file format is capable of reducing image file size up to 34% smaller in size retaining high-quality. WebP also supports transparency at just 22% additional byte.

Google regularly takes the change in its algorithm to provide the best experience to its users. Google was working on a new image format language past years and has released its stable in 2019. Images play a big role in website speed so Google has developed a new image format that will help developers to increase their website speed. If you are a developer then you should use this new image format to get a better result in Ranking.

Which Browser Supports WebP File

The webP image format is supported in Google Chrome, Mozilla Firefox, Microsoft Edge, Opera, and many other browsers. WebP image file format is not supported by Apple’s Safari browser.

WebP Image File Format Details

This webp image format was developed by Google, The format was first announced on 30 September 2010 as a new open standard for lossy compressed true-colour graphics on the web, producing smaller files of comparable image quality to the JPG, JPEG, PNG scheme.

File Extension.webp
Media Typeimage/webp
Type of FormatImage format
Written inC
LicenseBSD license
Open Format?Yes
Developed byGoogle
Initial Release30 September 2010
Stable Release1.0.3 – 4th July 2019

Questions and Answers

Should I use webP images on WordPress website

Yes, definitely you can use webp image format on your website which will increase your website speed, Pageinsight also recommend to serve images on webp format.

What are the disadvantages of using webP images on WordPress

Webp image format is good to increase website speed but it has also some disadvantages. Till now in 2021 webp image file format is not supported by Twitter and Safari browser which may be a disadvantage for some users.

If you face any problem you can contact me.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.