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.

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.

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.