WordPress creates lots of copies of the images I upload. How Can I stop this Mess?

Did you know that WordPress creates at least 7 different size versions of each image you upload? Let’s learn how to control and even avoid this…

For example, if you upload a 1920×1337 px image like the one below, with a file size of 605 Kb, other size copies will be created, which you can see in the same editor:

vegatble with a table and knife, example image

And which, of course, physically exist in your hosting, taking up precious and expensive disk space.

In the example you have uploaded 1 image of 605 Kb and the result is that you have 7 images that, together, occupy much more. Now do the simple exercise of multiplying this by all the images you upload.

Incredible, isn’t it?

Why does WordPress create these copies of the images you upload?

It sounds crazy, but it makes a lot of sense, keep in mind that WordPress is a web creation and publishing application that you can use from any computer, just by accessing your website with your username and password, and since you won’t always have an image editor at hand to change sizes or resolutions, WordPress creates copies at different (smaller) sizes of each image you upload.

It is actually an optimization strategy, so that you always have more optimal and smaller sizes to use in your content, the counterpart is that it fills the disk of your hosting with copies.

To do this, it uses the media settings screen of your web administration, where you can specify the sizes of the large, medium and thumbnail format.

default media settings of wordpress

But there are only 3 sizes and the rest?

WordPress not only creates those additional sizes you see in the media settings, the complete list is this:

  • Thumbnail (Size based on media settings)
  • Medium (Size based on media settings)
  • Large (Size based on media settings)
  • Medium Large 768px
  • Medium-large x2 1536px
  • Large x2 2048px
  • Scaling 2560px

Well, there aren’t that many … Oh no, there are more!

flower with different sizes

Yes, not only does WordPress make copies in different sizes of each image you upload, also the active theme will create several additional sizes, for its own thumbnails, grid designs and so on.

But the thing does not end here, there are also plugins that create new sizes, like WooCommerce for example.

additional images created shown in chrome console

You will find themes and plugins that use the following WordPress functions to add additional images:

  • set_post_thumbnail_size() - Create a custom size for the highlighted images
  • add_image_size() - Create additional images in the specified sizes

What can I do?

There are several possible strategies like resizing the images or cropping them.

But the most effective thing would be to avoid creating sizes you don’t need, right?

Prevent media setting sizes from being created

A quick and simple strategy, if the theme and plugins already generate the sizes they need, is to avoid WordPress creating the large, medium, and miniature sizes.

And you can do this as easily as setting the selectors to zero, like this:

wordpress media settings set to 0

With this you have already removed 3 additional files, but there are still more, as we have seen in the table above.

Prevent WordPress from creating all additional sizes with a code

If you are sure you don’t need any of the additional sizes WordPress creates, you can add this code to the functions.php file of the active theme or to your utility plugin:

/* Prevent WordPress from creating additional sizes */
function wphelp_disable_additional_media_wp($sizes) {
	unset($sizes['thumbnail']);    // disable thmbnail size
	unset($sizes['medium']);       // disable medium size
	unset($sizes['large']);        // disable large size
	unset($sizes['medium_large']); // disable medium-large size
	unset($sizes['1536x1536']);    // disable medium-large x2 size
	unset($sizes['2048x2048']);    // disable large x2 size
	return $sizes;
add_action('intermediate_image_sizes_advanced', 'wphelp_disable_additional_media_wp');
/* Prevent creation of scaling sizes */
add_filter('big_image_size_threshold', '__return_false');Code language: PHP (php)

Save and these sizes will no longer be created when you upload a new image.

Prevent WordPress from creating all additional sizes with a plugin

You can also do this with the help of a plugin, specifically Disable Media Sizes.

Once installed and active you have a new settings page with the name of the plugin from which to disable any or all additional sizes generated by WordPress.

disable media sizes plugin settings

From this moment on (not with the images already uploaded), as long as you have the plugin active, the sizes you have deactivated will no longer be generated.

Avoid creating “other” additional sizes of your images

If, in addition, you want to avoid creating additional sizes generated by plugins or the theme, a code like the following can help you:

/* Prevent other image sizes from being created
function wphelp_prevent_other_additional_sizes() {
remove_image_size('post-thumbnail'); // disable images added by set_post_thumbnail_size() 
remove_image_size('other-additional-size'); // disable any other additional size
add_action('init', 'wphelp_prevent_other_additional_sizes');

Well, I hope I have brought some light and peace to this madness of generating additional image sizes, so that it is you who controls WordPress and not the other way around.

Read this post in Spanish: WordPress crea montones de copias de las imágenes que subo ¿cómo lo evito?

How useful was this post?

Click on a smiley to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top