Digital Photography Tips, Tutorials and Resources
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
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.
Now you should connect your site using FTP client or cPanel. Simply go to the /wp-content/uploads/ 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:
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.
Then you’ll need to change all the values to 0, so it will stop WordPress from generating additional image sizes of your photos.
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.
Using WordPress and want to get Envira Gallery free?
Envira Gallery helps photographers create beautiful photo and video galleries in just a few clicks so that they can showcase and sell their work.