Disable Automatic Compression of JPG in WordPress


WordPress has built in compression for JPG images. Whenever you upload an JPG/JPEG image to WordPress media library, WordPress will automatically compress your images to 90% of the original quality, this is intended to help your pages load faster and keep file sizes smaller.

But sometime it’s essential to have high quality images on your website. For example if you are a photographer or have a portfolio website, then it’s very important that you must always have the highest quality images on your website.

If having best quality images on your website is absolutely necessary for you too, then you can disable automatic compression of JPG in WordPress by changing the default JPG compression to 100% and tell WordPress to load these file at their original quality.

All you have to add the following code snippet to your functions.php file, this will run when compressing your images and return the value of the quality you want.

// set minimum word count to publish post
function wcs_disable_image_compression( $arg ) {
    return 100;
add_filter( 'jpeg_quality', 'wcs_disable_image_compression' );
add_filter( 'wp_editor_set_quality', 'wcs_disable_image_compression' );

Leave a Reply

Random Post Selection ::

Recent Posts

Unlock Unlimited Downloads