How to Disable Large Image Scaling in WordPress

You may notice when you upload a large image to your WordPress site the file will likely have “-scaled.jpg” at the end of the file. This is because WordPress will automatically scale large images to help speed up your site. WordPress 5.3 introduced image scaling for large images over 2560px on the longest edge.

This means if you upload a 5000px by 3000px it’ll be scaled down to 2560px by 1536px. This is great for most sites, especially for users who upload large files and may be unaware of how large the file is. Since most users visiting your site won’t need to view image files that large having WordPress set the maximum helps with performance.

If you’re reading this post you’ll likely want to disable the automatic large image scaling in WordPress.

Let’s dive in how to disable WordPress resizing for large images:

How to Disable Image Scaling in WordPress with PHP

To add this code snippet to your WordPress site you can use the Code Snippets plugin or add it to your site’s function.php file. This snippet will tell WordPress to disable its auto resize function via the big_image_size_threshold filter.

<?php
// Disable WordPress' automatic image scaling feature
add_filter( 'big_image_size_threshold', '__return_false' );

After adding this snippet to your site your WordPress site will no longer scale down large images. Note that this will only take affect forward and not to previous uploads.


Increase WordPress Image Scaling Threshold with PHP

If you’d like to just increase the resize threshold from 2560px to a higher resolution you can use this code snippet. In the example below I set it to 4000px but you can change 4000 to whatever value your site needs.

<?php
// Increase the image resize threshold to 4000px on the longest edge
function smartwp_big_image_size_threshold( $threshold ) {
return 4000;
}
add_filter( 'big_image_size_threshold', 'smartwp_big_image_size_threshold', 999, 1);

This is a great option if you know exactly what resolution your site’s images need to be.


How to Disable Image Scaling in WordPress with Plugin

Not familiar with PHP? No problem! You can use the Disable “BIG Image” Threshold plugin. This plugin basically adds the above snippet above to disable the large image resize threshold.


Thanks for reading our guide to disabling WordPress resize function. If you have any questions about WordPress development let us know in the comments below.

Picture of Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 10 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way. Found this article helpful? Buy Me A Coffee

9 Responses

  1. Hey Andy, I was able to use this to get some of my larger images loaded on to site that it was not letting me load. in order to restore this setting back to default would I be able to change this to true instead of false?

    add_filter( ‘big_image_size_threshold’, ‘__return_false’ );

    change to

    add_filter( ‘big_image_size_threshold’, ‘__return_true’ );

    1. I use the Code Snippets program to put all my WP function changes in. Therefore, I do not have to mess with the templates or deal with making a child theme or wanting to change themes and having to move code around. That program also has a clickable switch to turn the individual function on or off. I am not affiliated with them, but it is a pretty neat plugin.

  2. Thanks for this. I was uploading small Webp images to my site and WP was scaling them 3 times larger. This code did the trick. I am not sure why WP does not have a switch built in to turn scaling off for the non-noobs that understand image sizing? This sort of goes against the idea of using less bandwidth and making websites faster.

  3. This snippet fixes this issue for me: Some of my images got bigger (in file size) when WordPress scales them. Strange WP would do that.

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly
Get the latest from SmartWP to your inbox.