WordPress version 5.3 made a change to the way it handles large images uploaded to the media library. This change was made to help address the issue of very large images being uploaded without first being optimized for the web.
Photos taken with a modern smartphone can be over 5MB in size which is much too large and unnecessary for use on a website.
So to help solve this, WordPress now detects big images and applies a scaling filter. The default threshold is 2560px, and will be applied to both the height and width, and the image will be scaled down. This scaled image will be used as the largest available size.
While this a good feature in general, not everyone will want images scaled. Photographers or artists showing portfolio pieces may want to show bigger images. We show much larger images on our website portfolio over at Spigot: https://spigotdesign.com/work
How to disable the scaling
The scaling feature is controlled by a new filter: big_image_size_threshold
. Disable it by returning false from the filter callback. Add the following to either functions.php
or a custom functions plugin:
add_filter( 'big_image_size_threshold', '__return_false' );
Change scaling threshold
If you prefer to change the threshold value instead of disabling, use this instead:
function cinch_image_threshold($imagesize, $file, $attachment_id){
return 1920;
}
add_filter( 'big_image_size_threshold', 'cinch_image_threshold',10,3 );
Does this still work?
I think this is just the beginning of WordPress attempting to help website owners manage images better. Let me know in the comments if you run into issues of if these scripts stop working.
21 Comments
Hi,
this doesn’t work anymore. Neither the snippet for removing the threshold nor the one to adjust it do anything.
I haven’t heard that this filter hook has been deprecated. What is the basis of your theory?
It works! Thank you so much!
Okay great to hear Jay, thanks for chiming in! A previous commenter stated that it no longer works, and I had yet to test. Cheers.
I just tried this and it works. I now have a lot of images to upload and attach to portfolios. Thank you very much!
Awesome, glad to hear it works Carole!
Hi! This may solve a problem I’m having with image resolution, but what will it do for page load times? I have a client whose using large images of gardens (he’s a garden designer). He sends me HUGE images. I reduce pixel size, then compress, and the image looks good…until it gets into the slider. Even then, some are better than others. I’m on a staging site at the moment, link included. Thanks, Bryan! Best wishes, Valerie
Hi Valerie,
Disabling the WP scaling feature and posting larger images will certainly have a negative affect on load time. If you’re struggling with image optimization I wouldn’t use this filter to solve that issue.
I checked the link you posted but couldn’t see the sliders. If you want me to take a closer look, jump on a chat during our business hours (8-6 Mountain time) and I should be able to give you some guidance.
Hi! Many thanks for this solution. The WP Theme Editor refused to save the filter, but I used a custom function plugins, and it all went well. My website is a comics site, I upload really tall images (sometimes over 10K px tall!), so I had to bypass this new feature. I hope that other webcomic creators that may be searching for an answer get here. Thanks again!
Thank you so much! It works like a charm!
What is the ‘cinch_image_threshold’,10,3 at the end? Saw someone recommend 10,4 instead.
Hi Nicolai, glad it worked for you.
That last parameter is
$accepted_args
and can probably be set to one. I’m not sure why I put it at 3…Unfortunately, the code no longer works, but there is a fix!
Just change to the following filter:
add_filter( ‘intermediate_image_sizes_advanced’, ‘__return_false’ );
Thank you for the original post!!
Not working for me, sorry. I used My Custom Functions plugin but it still scales to 2560px… this is crazy anyway wordpress should give us the option, some of us actually know what they are doing with big images… :-(
It works, just add priority, like so:
add_filter('big_image_size_threshold', '__return_false', 999, 1);
Works for me but I did not update wordpress 5.9 yet
Thanks for the tip!
Just tried this on WP 5.9 and it works like a charm. Thank you, Bryan!
The filter worked, but now i get a -rotated suffix in the name of my new pictures.
Hi not working for me .. using WordPress 6.0.1
Is there a new bit of code to make it work. Just driving me crazy!
Hi Amanda, as far as I can tell the filter is active, but you can also try this:
add_filter( 'big_image_size_threshold', function(){ return false; } );
The new code posted above with the priority set worked like a champ for me today!
add_filter(‘big_image_size_threshold’, ‘__return_false’, 999, 1);
My photographer customer is now happy.
Awesome, this snippet works perfectly. Just what I needed! Thanks
Comments are closed.