Add image upload 50% computer screen illustration
/ / / How to Disable WordPress Automatically Generated Images

How to Disable WordPress Automatically Generated Images

WordPress creates numerous copies of all images uploaded via the WP Media Library. These additional images are generated in various sizes, depending on your settings in WordPress, but also other defined sizes, especially from Woocommerce.

I really don’t like this. When I upload an image it’s not only resized into multiple sizes, but the WordPress compression is making the images much larger than my originally compressed images. How annoying is that?

You take the time to resize and compress the image before the upload, and then WordPress thinks that this image is not good for the web, so the images get resized into over 10 different versions (if you have Woocommerce installed), all larger files than the original. It’s mindblowing and there should be a core setting where we could turn this off.

The solution

Fortunately Jeff Starr in Perishable Press has written a very good article on the subject.

How to Disable WordPress Automatically Generated Images – Complete Guide

So what I did was to disable thumbnail, medium and large image in the default WordPress settings like this:

Disable default image sizes in WordPress
Disable default image sizes in WordPress

I also uncheck the Organize my uploads in month and year for normal websites with not a lot of images. And I don’t like any cropping done automatically.

Then I put this in the functions.php file.

//Disable image compression
add_filter(‘jpeg_quality’, function($arg){return 100;});

//Disable image sizes in addtion to WP defaults
function disable_image_sizes ($sizes) {
	unset($sizes['medium_large']); // disable 768px size images
	unset($sizes['1536x1536']); // disable 2x medium-large size
        unset($sizes['2048x2048']); // disable 2048px
	return $sizes;
add_filter('intermediate_image_sizes_advanced', 'disable_image_sizes');

NB: If you have woocommerce installed, you have to add some unsets in functions.php, but this depends on the Woocommerce image settings in your theme if the theme has Woocommerce support. You can try to upload an image, access the uploads folder with FTP and check out what new sizes that are generated.

Finally and pretty important about images filesizes

If you are using the images as featured images in posts and not just for design and layout, then I would recommend activating a Medium size in the Media settings in WordPress admin. Just set the Max width to 900px. Height can still be 0.

But, then you have 2 image sizes. So if you have compressed the big image before uploading, WordPress will auto-compress the new resized image. This is often very bad and sometimes the image size will sometimes get bigger than the original.

So to solve this you will need a compression plugin. I prefer that instead of adjusting the default compression in the function.php. More on that soon….