Have you ever wonder why your WordPress site disk space usage is very large?
Maybe you have a lot of images in different sizes. These images are generated by your WordPress installation (and theme) to optimize your site.
Let’s say you want to show people a small version of a big image, then you don’t have to make people load the original image, you simply only shows them the ‘resized’ version.
WordPress by default have 3 image sizes, however, some themes also generate different image sizes.
If you have 8 different image sizes on your WP installation, it’ll look like the picture below (taken from my own wp-content/uploads folder).
For every image uploaded, WP will generate 8 different image sizes, which most of them would probably remain unused.
So that’s a lot of disk space wasted!
Luckily, I found a way to delete all those unused images and prevent them from regenerating again.
First, you need to prevent them from happening again by removing the additional image sizes.
Take a look at this post by WPMU DEV and you’ll find out how to add additional image sizes, and to remove them just do the opposite (find the code in your functions.php file and remove them).
Okay, after you prevent them from happening again, let’s delete all of your unused images.
Step 1: Install 2 plugins, Thumbnail Cleaner and Regenerate Thumbnails.
You know how to install plugins, right? And don’t forget to activate them.
Step 2: Backup your entire site, and your /uploads folder using the Thumbnail Cleaner feature.
The Thumbnail Cleaner plugin has a backup feature which is really nice and convenient. Use it.
For a safer option, I usually do a full backup using cPanel.
But you get the point, it’s doing backup for safety measures.
Step 3: Analyze the unused and old thumbnail sizes, and clean them.
Don’t know how to use this plugin? Well, look it up at their official WP page.
It’s pretty simple if you have some experience with WordPress (which I assume you have).
Step 4: Regenerate new thumbnails using Regenerate Thumbnails.
Okay, start regenerate the new thumbnails, and make sure you already know what kind of image sizes you want.
And don’t worry, the newly generated images will be placed at the same folder as the original images.
Step 5: Wait for a few days, see if your website running perfectly.
This is just a precaution, you know, just in case something happens.
Step 6: Delete the backups, the plugins, and completely remove the leftover files and folders via cPanel.
Well, now you’re sure that your website is running smoothly, then you can delete all the backup files generated by Thumbnail Cleaner.
After that, you can uninstall the plugin and completely delete all the leftover files and folders via cPanel (or whatever you prefer).
Step 7: Enjoy your new free disk space.
It feels like a heavy load is just being removed from my mind after I did this.
Maybe some of you wondered, why am I doing this? Is it necessary to delete all those files and prevent them from happening again?
Isn’t the hosting plan can afford that much space for all those useless stuff?
Well, here’s the answer.
I’m a minimalist, I don’t want any extra useless stuff in my life.