Generic filters
Exact matches only
Search in title
Search in content
Filter by Categories
PHP Script
Easy Digital Downloads
MainWP WordPress Manager
Ultimate Member
Themify Themes

How to prevent WordPress from shrinking (Scale) image sizes

In this article, I quickly share with you a pretty cool trick but not popular, which is to prevent WordPress from shrinking (scaled) the image size. This trick will be useful for those of you who want the uploaded image to keep its original size.

Note that the purpose is to keep the image size (width and height), not the size of the image file. Larger images will usually be sharp, but that doesn’t mean every large size will be sharp. A sharp image is determined by many other factors, but we do not discuss that in depth here.

Why does Wordpress shrink images when uploading?

Since version 5.3, WordPress started to limit the maximum image size when uploading. Specifically, images with a width/height greater than 2560px will be scaled, ie reduced in size.

The reason WordPress does this is because they think that large images are not really necessary. With a limit of 2560px (max for width/height) that’s more than enough. Shrinking the image size like this helps to make the website lighter.

After many years of interacting with my brothers using WordPress, I noticed that people tend to use images with small sizes. Usually the image has a standard width of less than 800px, preferably full HD (1920px) or HD (1024px). Images are also compressed to be as light as possible to optimize page loading speed. But as a result, the images of most sites are often quite BAD.

Blurry screenshot instructions are difficult to see and follow. That’s why, me and some other brothers (the delicate side. vn is an example) tend to use high-definition images to watch for “glamorous eyes” ^^.

But since WordPress 5.3 was released, with the “arbitrary” feature of thumbnails that made me quite uncomfortable, the image displayed on the web is no longer the clearest version. That’s why I found a way to prevent arbitrarily shrinking this original image. For details, please see the instructions on how to do it!

RECOMMENDED: By doing this you will trade page load speed for the viewing experience (beautiful images). Not sure if you know, heavy images will take longer to load the page. The SEOer or you specializing in website speed optimization will not like this at all

How to prevent WordPress from “arbitrarily” shrinking – scaled images, reducing the quality of the original image

The way to do it is quite simple, you insert the code below at the end of the functions.php file of the theme you are using.

// prevent WordPress shrinking images

add_filter( 'big_image_size_threshold', '__return_false' );

If you don’t want the code inserted into the functions.php file to be lost after updating the theme, you can use Childtheme or plugin Functionality