How to Prevent WordPress from Generating Image Sizes
WordPress generates each images in three sizes thumbnail, median and large. Additionally your WordPress theme generates more sizes of the images for the post thumbnails which will increase the data size and due to the limited disk space you may need to upgrade the web server resources. In this guide you will learn how to prevent WordPress from generating image sizes.
Why Prevention of Generating Image is Important?
WordPress generates each images in three sizes, apart from that your themes have its own size for the featured images, post thumbnails, sidebar and each images can generates upto 10 images of different sizes.
If your blog contains lot of images and each images may generates upto 10 times then soon disk space in your web server will be full and needs to be upgraded. Since your website data will increase it will be time consuming while keeping backup and also affect your blog performance.
You can see the numbers of each images generated by the WordPress and theme. Connect to your web server via FTP client such as FileZilla. Once connected, open the root directory then /wp-content folder and Upload folder where you will find the number of generated images.
Time needed: 10 minutes.
How to Prevent WordPress from Generating Images Sizes
- Configure WordPress Media Settings
- Prevent Themes from Generating Images
1. Configure WordPress Media Settings
You can easily stop your WordPress website generating multiple images simply going to Settings then Media. You need to set the default value of thumbnail, medium and large size to 0 and click on Save Changes. It will prevent WordPress from generating multiple images for new uploads.
2. Prevent Themes from Generating Images
Your WordPress themes also creates multiple images for the featured images and post thumbnails. You need to remove or deactivate line of code in your theme function.php to prevent your theme to generate images.
Go to Appearance and click on theme editor. Click on function.php from the right side of the screen. If you can find the codes containing add_image_size function that your themes is generating images which you can prevent by removing or deactivating the line of code. It is recommended you to deactivate the line of code adding two forward slash (//) before the code and update the changes.
add_image_size( 'thumb-standard', 320, 320, true );
You may also find the code containing set_post_thumbnail_size which need to be removed or deactivate to prevent generating post thumbnail images. The code look like this
set_post_thumbnail_size( 150, 150 );
Removing themes default settings for generating images may disable functions to create gallery and the post thumbnail images in your website. Only do this if you are certain of the effect in your website.