Set the WebP image quality to 90 in WordPress 5.8

Set the WebP image quality to 90 in WordPress 5.8 on child sites.

Snippet Type

Execute on Child Sites

Snippet

// Use a quality setting of 90 for WebP images.
function filter_webp_quality( $quality, $mime_type ) {
  if ( 'image/webp' === $mime_type ) {
     return 90;
  }
  return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 );
2 Likes

That’s pretty cool! Thanks for the heads-up :smiley:

1 Like

What is the default value used by WordPress?

Let me check in WordPress core for WebP images default.

Default image quality is set as 82 in WordPress core it used to be 90.