Do you want to prevent WordPress from creating additional image sizes?
When you upload an image to WordPress, it automatically generates numerous copies in various sizes. Different themes and plugins can boost the number of sizes generated even further. If you have a lot of photographs on your website, this may raise your storage requirements and the size of your website backup file.
In this article, we’ll teach you how to prevent WordPress from creating picture sizes.]
Table of Contents
Why is it necessary to prevent WordPress from generating image sizes?
When you upload an image to your WordPress website, multiple copies of the picture in various sizes are automatically generated. In addition to the original image, thumbnail, medium, and large sizes are generated by default.
Additional image sizes can also be generated by themes and plugins. You may discover that you have five or 10 copies of each image in various sizes.
During the upload process, the additional image sizes are generated and saved. This has no effect on your visitors or slows down your website, but it does necessitate a little more storage space.
The extra space taken up by these additional photographs is usually not a problem. Most WordPress hosting providers provide ample disk space, which is sufficient to store thousands of photographs.
Having said that, some users may choose to restrict WordPress from creating picture sizes.
For example, when customers backup their website with hundreds of photographs, they may discover that their backup has grown very huge and is taking longer to complete. Other users discover that they never use certain image sizes, and deactivating them saves storage space.
However, be cautious when removing image sizes. They may be required by your theme for post thumbnails, sliders, attachments, or special post kinds. Remove them only if you are certain and aware of the impact on your site.
That being said, let’s look at how to prevent WordPress from creating picture sizes.
Disable WordPress from generating different image sizes
#1 Manually via WP-Admin
This is the simplest method for removing WordPress’s default image sizes. You can disable the picture sizes you don’t require from your site with a few mouse clicks.
To prevent WordPress from creating different picture sizes after uploading, use the following steps:
- Log in to WordPress as the Administrator. In the left sidebar of the Dashboard,
- navigate to
Settings > Media
In the Media Settings, set the width and height to ZERO for the following sizes:
- Thumbnail Size
- Medium Size
- Large Size
#2 How to Prevent WordPress from Creating Image Sizes via Plugin
The first step is to install and activate the Stop Generating Unnecessary Thumbnails plugin.
After activation, go to the Media » Image Sizes page to disable image sizes.
Once there, you’ll notice that all extra image sizes are shown on the left side of the screen. The ones in red indicate that these sizes are enabled and will be generated.
You must drag any size you do not want to the right column. This will disable it and prevent it from being generated when you upload an image.
After dragging each image size to the right, it will be highlighted in green. A notification will appear at the top of the screen stating that ‘0 Thumbnails will be created’.
Make sure to click the ‘Save Settings’ button to activate your updated settings. When you upload a picture to your WordPress blog, no extra image sizes are created.
However, you will retain all of the additional sizes of any photographs you have previously submitted. Let’s look at how to delete unneeded image sizes in WordPress.
Simply click the ‘Regenerate’ tab, and then the ‘Regenerate’ button.
All extra photographs will now be removed from your media collection. To minimize overloading your server, this will be done in batches of 50.
How can I get a list of all registered WordPress Image Sizes?
To receive a list of all registered image sizes, add the following code to the functions.php file for your theme or any plugin-specific file.
// get a list of all registered WordPress Images Sizes
$image_sizes = get_intermediate_image_sizes();
echo '<pre>';
print_r($image_sizes);
echo '</pre>';
Remove this code as soon as you know which registered picture sizes are available.
#3 Using Some Simple Code Remove all default image sizes
To eliminate all WordPress default image sizes by coding, first install and activate the Code Snippets plugin. Then, navigate to Settings.
Click the Add New button, you’ll be sent to an editor where you can enter custom codes.
To begin, give your snippet a name. Then, copy and paste the code from below into the editor.
function add_image_insert_override( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'medium_large' ] );
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_insert_override' );
Then, click Save and Activate.
Congratulations, you have deleted all additional image sizes from your site and prevented WordPress from producing them in the future.
We hope this tutorial helped you learn how to prevent WordPress from generating image sizes. You may also want to learn How to Clone WordPress Website via Softaculous? or check out our list of the best WordPress Tips & Tricks. Do you still require assistance? Please leave a comment below.