Disable Image Scaling in WordPress 5.9
WP while ago 5.3 version added a setup which auto scales larger images.
In typical WP form there are no options, this is now an imposed ‘rule’ defaulted in the CMS.
This is not needed and users should be allowed to upload larger images, I also use other tools to take images offsite so WP interfering here is not good.
For image SEO this is also bad it also renames the images as it resizes it, which is not ideal. When you upload an image it should just upload this modification of the images you upload is a plugin function and is not advised in the core of your WP.
It is training bad behavior too, images should generally be 1920×1080 at a max, but the CMS cannot act as the brain here. There are use cases for larger images. This similar to blocking of SVG uploading is not good for a simple work flow using WP.
Especially if you have an image based website, you have to able to upload larger size images.
To Remove That Function:
Copy the code below into your functions.php file:
add_filter( 'big_image_size_threshold', '__return_false' );
or use this plugin:
To increase the limit
function dg_big_image_size_threshold( $threshold ) { return 10000; // change this to the px Value you want }
add_filter('big_image_size_threshold', 'dg_big_image_size_threshold', 100, 1);
To Find Your Functions File:
- You should be using a child theme, if not get that resolved first
- Then via WP you can edit the theme files
- Then find the functions.php file
- Copy, paste at the end then save
- WP has a feature to make sure this doesn’t crash.
- Better you should do this via FTP with a text editor with undo steps. CTRL Z saves us all from time-to-time. But always copy the page before doing any changing on it as a backup and security.
I hope this will work for you as it works for me smoothly. I use this little code when I need it with almost every WordPress website I create. Especially if need to post too much images or for image based websites, whenever need it, a life saver!