How WordPress Is Eating Up Your Server Space And How To Solve It

The Problem

You can save WordPress server space with proper strategy as WordPress generates several copies of all images which are uploaded by the WP Media library. These extra images are in different sizes depends on settings and other factors. We usually can’t realize its harmful effects if we don’t have enough images on our website. But if we deal with lots of images on our website then the additional images can eat up our server space. It is a total waste of our server space. So how to keep the website light and fast we will try to know from this blog.

WordPress generates almost Seven additional images for every single upload.

WordPress server space

Even more extra images can create depending on the theme for WordPress core functions.

  • set_post_thumbnail_size() — Generates a custom size which is used for Featured Images
  • add_image_size() — Generates extra images for any specified size(s)

In the picture, we are seeing that hiking-v1.jpg is the main image, and the rest of them are additional images that have been stored in the server.

Solution: Saving WordPress server space

So, what can be the solution and how to conserve the server space? The main trick is that we have to disable each of the additional images. We can control these extra images by using custom codes or plugins.

1. From the settings

To disable additional thumbnail images we have to set the Thumbnail Size option to 0. For doing this we should go to Settings -> Media -> Image Sizes



Then we should set the Thumbnail size, Medium size and Large size to “0”. It will disable them to generate additional images.

2. With some code

Besides we can programmatically disable additional Thumbnail images. For doing this we have to add the following Code Snippet to our theme’s functions.php file.

function cx_disable_thumbnail_images( $sizes ) {
	unset( $sizes['thumbnail'] ); // disable thumbnail size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_thumbnail_images' );


After that, for removing additional Medium images we can add the following Code Snippet to our theme’s functions.php file.

function cx_disable_medium_images( $sizes ) {
	unset( $sizes['medium'] ); // disable medium size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_medium_images' );


To disable additional Large images programmatically we just simply paste this Code Snippet to our theme’s functions.php file.

function cx_disable_large_images( $sizes ) {
	unset( $sizes['large'] ); // disable large size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_large_images' );


Then if we want to programmatically disable additional Medium Large images we just simply paste this Code Snippet to our theme’s functions.php file.

function cx_disable_medium_large_images( $sizes ) {
	unset( $sizes['medium_large'] ); // disable medium_large size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_medium_large_images' );


To disable 2x Medium Large Image we should just add this code snippet to our theme’s functions.php file.

function cx_disable_2x_medium_large_images( $sizes ) {
	unset( $sizes['1536x1536'] ); // disable 2x_medium_large size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_2x_medium_large_images' );


Besides we can disable 2x Large Images by adding this code snippet to our theme’s functions.php file.

function cx_disable_2x_large_images( $sizes ) {
	unset( $sizes['2048x2048'] ); // disable 2x_large size
	return $sizes;
add_action( 'intermediate_image_sizes_advanced', 'cx_disable_2x_large_images' );


Then we can easily remove Scaled images by using this code snippet in our theme’s functions.php file.

add_filter( 'big_image_size_threshold', '__return_false' );


If we want to disable all the additional images at a time programmatically then we should just add this code snippet to our theme’s functions.php file.

// disable generated image sizes
function cx_disable_image_sizes( $sizes ) {
	unset( $sizes['thumbnail'] ); // disable thumbnail 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 2x medium-large size
	unset( $sizes['2048x2048'] ); // disable 2x large size

	return $sizes;
add_action('intermediate_image_sizes_advanced', 'cx_disable_image_sizes');
// disable scaled image size
add_filter( 'big_image_size_threshold', '__return_false' );
// disable other image sizes
function cx_disable_other_image_sizes() {
	remove_image_size('post-thumbnail'); // disable images added via set_post_thumbnail_size()
	remove_image_size('another-size'); // disable any other added image sizes 
add_action( 'init', 'cx_disable_other_image_sizes' );

3. With a plugin

This code snippets above will disable all the additional images except the original images. But we can do these processes by installing a free WordPress Plugin named Stop Generating Unnecessary Thumbnails (Formerly Stop Generating Image Sizes) with a few clicks.


This plugin prevents from generating unnecessary images. Besides, it works with any plugin and theme. It’s highly compatible with Woocommerce and multi-sites. Then the plugin is super easy to install and configure. Most important thing is that it is totally free and there are no premium bindings in the plugin.



This plugin has several amazing features, one of them is regenerate thumbnails. This cool feature allows you to delete your previous unwanted images. For this, you have to just go to the Regenerate Thumbnails tab and click on the Regenerate Thumbnails button. That’s it! Hundreds of additional images will delete within a second.



So, controlling WordPress images is important for those sites with lots of images. Besides it is also necessary for those who have several images only because it will keep their website light and fast. We hope this article will help you to prevent WordPress from creating additional images and will save your server space.

Share on facebook
Share on twitter
Share on whatsapp
Share on linkedin

Related posts based on your interest

Leave a Reply

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