Envira Gallery Blog

Digital Photography Tips, Tutorials and Resources

Stop WordPress from Generating Image Sizes

How to Stop WordPress from Generating Image Sizes

by Waseem Abbas on Dec 8, 2016

Did you know that WordPress generates additional image sizes whenever you upload a photo? These extra images take up space on your hosting server. For a photographer with hundreds of thousands of photos, these additional image sizes can create issues. In this tutorial, we will share how to stop WordPress from generating image sizes.

Whenever you upload one image to WordPress, it can turn into 5 or more images because of the additional sizes that WordPress (and your particular theme) generates. To stop WordPress from generating different image sizes, you’ll need to follow these 3 steps:

  • Step 0. Check your WordPress hosting
  • Step 1. See how many additional sizes WordPress is creating for your image
  • Step 2. Stop WordPress from generating image sizes
  • Step 3. Remove default code from theme’s file

Ready to get started? Let’s go!

Step 0: Check Your WordPress Hosting

First thing you need to make sure is that you choose a reliable WordPress hosting like Hostgator or WPEngine that gives you decent disk space to upload all your photos.

Especially if you’re a photographer or uploading a lot of photos, we recommended that you always keep regular backups of your WordPress site. In fact, every website owner should be keeping backups in case anything goes wrong with your site.

However, even though you have a lot of space to upload many photos, these extra photos will slow down your backup process and create heavy backup files on your server.

If you aren’t using these additional image sizes anyway, then you can disable them by following the remaining steps below…

Step 1: See How Many Additional Sizes WordPress is Creating For Your Images

When you upload an image in WordPress, it creates three default sizes: thumbnail, medium and large. However, you may also find other image sizes being generated by your WordPress theme.

To check for additional image sizes, you can go to Media » Add New from your WordPress backend. Go ahead and upload an image.

Upload Images

Now you should connect your site using FTP client or cPanel. Simply go to the /wp-content/uploads/ directory.

Upload Directory

All of the photos you’ve uploaded are sorted by year and month. (To learn more, you can also check out where does WordPress store uploaded images.)

Now you can see the number of copies generated by WordPress. Here’s a screenshot example:

Image Sizes

In our case, we have 6 extra sizes being generated for each image uploaded. These include the default WordPress sizes, and images that are generated by our particular WordPress theme.

Step 2: Stop WordPress from Generating Image Sizes

Next, since you now know the number of additional copies for each image, you can simply go to Settings » Media from your WordPress admin backend.

Default Image Sizes

Then you’ll need to change all the values to 0, so it will stop WordPress from generating additional image sizes of your photos.

Change Default Sizes

Now we have taken care of the 3 default sizes generated by WordPress, but there are still 3 more being generated by our theme. In the next step, we’ll need to stop our WordPress theme from adding extra copies of images…

Step 3: Remove Default Code From Theme’s File

Other image sizes aside from the 3 default sizes are being generated by your theme. To stop this, go to Appearance » Editor and edit the functions.php file of your theme.

In this file, you will see a few lines of code that look similar to this example below:


set_post_thumbnail_size( 1200, 9999 );


add_image_size( 'homepage-thumb', 220, 180, true ); 

These functions like set_post_thumbnail_size and add_image_size are used in your theme’s file to create additional image sizes. Simply delete these lines of code to prevent your WordPress theme from creating any additional copies of your images.

That’s all. We hope this article has helped you to learn how to stop WordPress from generating image sizes. You may also want to check out our guide on how to resize WordPress images automatically.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Comments

  1. Hello,
    I have a running image sharing website, usually, we insert more than 20 images in a single post. I want to prevent WordPress from generating different image sizes for inserted images, except for the post featured image.

    For example, If there are 20 images in my post. I want WP to generate image sizes for the Featured image only, and for other inserted images i don’t want different sizes.
    Actually, the problem is the limited storage space and the other problem is that with those useless image sizes the backup file has more size.

    How can I achieve this?
    I appreciate your help.

  2. Thanks for the article Waseem

    But won’t the theme functions file be overwritten when the theme is updated? Shouldn’t this be done in a child theme?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.