WordPress is the leader in the CMS market offers many tools to help write blogs with ease. WordPress by default generates three different sizes for an image you upload along with that your themes and plugins may also generate additional image sizes based on requirements.
Having too many copies of the same image can take up your storage space and will also lead to an increased size of the backup file.
In this article, I am going to explain why multiple image sizes are generated for an image and how to prevent WordPress from generating multiple image sizes. Let's get started.
Why multiple image sizes?
Displaying too many original uncompressed images on a webpage will slow down your webpage. Webpage loading time is considered as the major factor for SEO and if your webpage loads slowly then you may lose your users too.
WordPress by default generates three image sizes thumbnail, medium, and large. While displaying multiple articles with titles and images on the webpage, it is a better option to display the thumbnail version of an image.
Need to stop WordPress from generating multiple image sizes
As we now know that not only WordPress but your themes also generates multiple image sizes. You may end up with 5 to 10 duplicate copies of an image.
Having these many copies will not only put more load on your storage space, but it will also lead to a larger backup file in size.
It is better to do little manual customizations to save storage space without affecting your website speed.
How can we prevent WordPress from generating multiple image sizes?
Follow the steps given below to stop WordPress from generating duplicate copies for an image.
Log in to your WordPress dashboard and go to Settings » Media.
Here you will get the dimensions of the default image sizes generated by WordPress. Simply to stop WordPress from generating these sizes, set their width and height to zero. I would suggest keeping the thumbnail dimension as it is and disable only the medium and large image size to zero.
Once you are done with changes click on the "Save Changes" button.
We are done with disabling WordPress default image size generation, now we will see how to stop themes and plugins from generating multiple image sizes.
Now we need to access the "functions.php" file of the active theme. Go to Appearance »Theme Editor.
Select Theme Functions("functions.php") in Theme Files option present in right-hand side.
Now inside loaded file, search for text "add_image_size" and "set_post_thumbnail_size" .
You can remove these lines from your theme's "functions.php" file to stop them from generating multiple copies of your uploaded image.
Note: Different Image sizes generated by your theme are used for post thumbnails, sliders, and custom post types. Only remove these image sizes if you are aware of how it can affect your website.
You should always take your hosting needs and WordPress optimization from start. Later on, it can really become complex to control many things like storage space, bandwidth e.t.c. Bluehost is the most popular hosting recommended for WordPress hosting.
When it comes to media files like images and videos, it can consume a lot of space if not handled properly. Always prefer to optimize media file before uploading. I hope this article will help you prevent WordPress from generating multiple image sizes. Please provide your valuable feedback and suggestion in the comment section below.