Since WP 7.1, it introduces Client-Side Media Processing that brings several benefits, including compress images. That makes me think it’s time to remove my favorite plugin that compresses and converts images to .webp, Modern Image Formats. But while WP 7.1 does compress images when uploading, it doesn’t convert them to .webp as that plugin does.
To fill that gap, I use this little snippet code:
// Auto-convert JPEG uploads to WebP client-side in WordPress 7.1+
add_filter( 'image_editor_output_format', function ( $formats ) {
$formats['image/jpeg'] = 'image/webp';
return $formats;
} );Code language: PHP (php)
Now I can remove that plugin gracefully.
