How to disable WordPress 5.3 image downscaling feature?

WordPress 5.3 introduced big image downscaling feature that basically resizes the images above certain threshold during the upload.

The goal is to prevent huge images being uploaded and embedded in the content which will slow down the page load.

By default this threshold is 2560px width/height and this means that if you upload image bigger than 2560px in width or height it will downscale the image to maximum 2560px width or height depending which one of those was passing the default threshold of 2560px.

Please note that this will still keep the original image but it won’t be used.

Eg. If you upload image called my-image.jpg that is 3000×1800 it will be resized to 2560×1536 and named my-image-scaled.jpg and when you embed this image it will embed the my-image-scaled.jpg while my-image.jpg is still unused and takes unnecessary disk space.

There is nothing wrong with this approach but still some people will not find this useful if they need to host bigger quality images.

To disable this feature you can simply add this code in your functions.php file

add_filter( 'big_image_size_threshold', '__return_false' );

To increase the threshold add the following code in your functions.php file instead:

/** * Increases the threshold for scaling big images to 4000. * In this case all the images that are above 4000px (width or height) * will be downscaled to 4000px. * * @param $threshold * @return int */ function dg_big_image_size_threshold( $threshold ) { return 4000; // new threshold } add_filter('big_image_size_threshold', 'dg_big_image_size_threshold', 100, 1);

If you have any questions feel free to drop me a message here or in comments 🙂