WordPress 5.8 adds native WebP image format support

The latest version of WordPress now fully supports WebP images without the need for plugins or additional code.

WebP Logo

Matt Mullenweg, a founding developer of WordPress, announced on July 20, 2021, the release of WordPress 5.8 Tatum. Buried amongst the new features was a mention about WordPress adding support for WebP.

WebP is an image format that can significantly reduce the file sizes of images without loss of visual clarity, and it fully supports transparency. WebP is the perfect successor to JPEG and PNG image formats. Frustratingly, the format has taken a significant amount of time to be supported by all major web browsers. The last browser to add support for WebP, Apple’s Safari, waited ten years before it finally added support in 2020.

The extreme delay of Apple’s support for WebP affected the entire web design ecosystem. Adobe Photoshop still doesn’t support WebP, and the popular photo editing app for Mac, Pixelmator Pro, only added support for WebP after learning Safari would support it.

Export for Web
“Export for Web” for WebP in Pixelmator Pro

The delay also affected content management systems like WordPress. Before version 5.8, the only way to use WebP images in WordPress was to use a plugin or to add workaround code to the active theme’s functions.php file.

Code Example
Workaround code to enable support for WebP in earlier versions of WordPress

Version 5.8 provides full native support for the WebP image format. WordPress users can now add and use WebP images the same way they do with PNGs and JPEGs.

If a WordPress instance uses version 5.7 or earlier and uses a plugin or workaround code to make WebP images work, they may want to keep it in place until after the update to version 5.8 to keep WebP images working properly. After the update, they can safely deactivate the plugin or remove the workaround code from the functions.php file. As always, make sure you have a good backup and easy restore option, like WP Engine has, just in case something goes wrong.

The new WebP support in WordPress lets you control the compression quality by using the wp_editor_set_quality filter. Adam Silverstein, Developer Relations Engineer at Google and WordPress Core Committer, shared code that theme and plugin developers can use to set the WebP quality setting. For example, saving the following code in the functions.php file will make WordPress convert all newly uploaded WebP images with a quality setting of 75%.

WordPress 5.8 with native WebP support is available to download now.

Related News

Jon is the founder of Coywolf and the EIC and the primary author reporting for Coywolf News. He is an industry veteran with over 25 years of digital marketing and internet technologies experience. Follow @henshaw