Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@henshaw
Created July 21, 2021 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henshaw/5cf736e248e0f0edd6a1e195b9bd6852 to your computer and use it in GitHub Desktop.
Save henshaw/5cf736e248e0f0edd6a1e195b9bd6852 to your computer and use it in GitHub Desktop.
WordPress WebP quality setting - Save in functions.php
// Use a quality setting of 75 for WebP images.
function filter_webp_quality( $quality, $mime_type ) {
if ( 'image/webp' === $mime_type ) {
return 75;
}
return $quality;
}
add_filter( 'wp_editor_set_quality', 'filter_webp_quality', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment