Created
July 21, 2021 00:42
-
-
Save henshaw/5cf736e248e0f0edd6a1e195b9bd6852 to your computer and use it in GitHub Desktop.
WordPress WebP quality setting - Save in functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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