How to Stop WordPress from Generating Additional Image Sizes
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.
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.
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:
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.
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 );
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.