Adding new mime type (WebP) in WordPress

Adding new mime type (WebP) in WordPress

Recently while finishing up a site with a few high quality images that needs to be transparent, I needed it to be small (100kB is acceptable for me), because I dont want people to load 10MB for a site. I remembered that there’s a new (well, not new but I just didnt use it as often as I should) image format, WebP. As of now, WordPress 4.5.3, it does not support webp as its mime type, so if you tried to upload it, you’ll get a message or something about it not being supported.

Since my image editing program cant save in WebP (maybe it could, but have not bothered to search further). I converted my PNG to WebP at From 436KB to 44KB!

Just add the following code into your template’s functions.php (In the backend, Appearance -> Editor -> functions.php)

Yeay for small image size!


Add yours
  1. 1
    Gulshan Kumar

    Hello, I found this information very helpful in difficult moment. Looking forward for more awesome updates.
    Thanks a lot Mkhairul. Before appying this trick, I was getting an error while uploading webp format images, after adding this snippet through Code Snippet plugin. my problem successfully solved with in second.

+ Leave a Comment