Soliloquy Blog

WordPress slider tips, Tutorials and Resources.
Additional Image Sizes

How to Stop WordPress from Generating Additional Image Sizes

by Waseem Abbas on June 29, 2017

Are you wondering why WordPress is generating additional image sizes for your photos? When you upload an image in WordPress, it creates 5 or more additional sizes that take up more space on your site and can also affect your WordPress site performance. In this tutorial, we will share how to stop WordPress from generating additional image sizes.

WordPress and your theme has this function to generate a few different sizes for each image that you upload on your site. You can edit the settings in your theme and WordPress files, so it won’t create more images for you.

To stop WordPress from generating additional image sizes, you’ll need to follow these 3 steps:

  • Step 1. Check additional image sizes in WordPress
  • Step 2. Edit WordPress media settings for image sizes
  • Step 3. Edit your theme file to remove default code

Ready to get started? Let’s go!

Step 1: Check Additional Image Sizes in WordPress

By default, WordPress adds 3 image sizes for each image that you upload. These are the WordPress default image sizes other than the additional sizes created by your theme. A WordPress theme generates 2 or more image sizes additionally.

You can go to Media » Add New in WordPress admin and add a new image to see the additional image sizes on your site.

Add Image

After adding images in WordPress, you should go to /wp-content/uploads/ using an FTP client or the cPanel dashboard of your web hosting account.

cPanel Directory

WordPress sort all your images into year and month. You can open any folder and see how many image sizes are there as shown in this image below:

Image Sizes

You can notice 5 additional images for each photo in this folder. If you don’t want all those additional image sizes, then you can stop WordPress from generating them for your site.

Step 2: Edit WordPress Media Settings for Image Sizes

To stop WordPress from generating additional image sizes, you’ll need to go to Settings » Media from WordPress backend.

You’ll notice thumbnail size, medium size, and large size options. These are the 3 WordPress default sizes.

Media Settings

Simply replace all the values with 0 and WordPress will not create additional sizes for your images. Next you need to edit the theme file for simple image sizes.

Step 3: Edit Your Theme File to Remove Default Code

To edit the code from theme file, you should go to Appearance » Editor. Go ahead and edit your functions.php file from here.

You need to delete a few line of code from this file that represents the default image sizes. It may look similar to this code below:

[php] set_post_thumbnail_size( 1200, 9999 );
add_image_size( ‘homepage-thumb’, 220, 180, true );
[/php]

In this code, the two fuctions set_post_thumbnail_size and add_image_size allows your WordPress theme to generate additional image sizes. Removing the code will make sure that your theme doesn’t add more images in WordPress.

That’s all. We hope this tutorial has helped you to learn how to stop WordPress from generating additional image sizes. You may also want to check out our guide on how to fix the image size for your slider in WordPress and read about 25 most common WordPress errors and how to fix them.

If you like this tutorial, then please follow us on Facebook and Twitter for more free WordPress guides and resources.

Waseem Abbas is a content writer for SoliloquyWP and Envira Gallery.

Comments

    Bj

    November 27, 2017

    There has to be a way to stop this code from working using a child theme and not by changing the theme’s coding which, as we all (should) know our changes will be lost when the theme is updated.
    I do not understand the workings of child themes as well as I would like to so can you help with this?

    Reply

      Waseem Abbas

      November 29, 2017

      Hey, you are right. Child themes are the safe solution, so your theme can keep updating, but it won’t wipe out any customizations you make (such as this) to your site. You can follow along with a good article from our friends at WP Beginner on how to create a child theme: http://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/

      Let us know how it works. 🙂

      Reply

Leave a Reply Cancel reply

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.