Two simple hooks to add to your functions.php
The image quality of thumbnails generated by WordPress is rather low. You can easily increase the quality with the following filters:
/**
* /my-child-theme/functions.php
*
* Sets the image quality of pictures uploaded on WordPress.
* Defaults to 82, between 0 and 100.
**/
add_filter( 'jpeg_quality', fn () => 100 );
add_filter( 'wp_editor_set_quality', fn () => 100 );
The reason why we need two hooks is that wp_editor_set_quality
will get overwritten by the jpeg_quality
hook specifically.
That’s it! as easy as that!