Enable WebP in WordPress
What is WebP
According to google
WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.
WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.
Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes. For cases when lossy RGB compression is acceptable, lossy WebP also supports transparency, typically providing 3× smaller file sizes compared to PNG.
WordPress in stock format not letting you ro upload .webp files, If you try to upload webp files you will land in an error display like this
Sorry, this file type is not permitted for security reasons.
Solution
To enable .WebP inside your WordPress Installation , there is a simple tweak. Just go to
Appearance > Theme Editor > Functions.php
Add this to end of file
// Enable webp image format
function webp_upload_mimes($existing_mimes) {
$existing_mimes[‘webp’] = ‘image/webp’;
return $existing_mimes;
}
add_filter(‘mime_types’, ‘webp_upload_mimes’);
Save File and Exit, you are ready for the go , here are some sites for image conversion of PNG,JPG in to WebP
- https://ezgif.com/jpg-to-webp
- https://image.online-convert.com/convert-to-webp
- https://webp-converter.com/
you may find more on google search
Recommended Posts
Best Blogging Websites on WordPress
October 7, 2024
Top Fitness & Gym Websites on WordPress
September 10, 2024