If you switch to a new WordPress theme, you may know that it’s best to use a tool to regenerate the thumbnails, the different image sizes used your layouts. Unfortunately, you may not be aware that you also need to delete the unused thumbnails that remain in your WordPress site. Here’s one way to clean up the media library.
New Theme, Old Mess
The way I discovered that I had a problem was from an error message saying that there wasn’t enough space to upload new images.
I thought “No problem, I’ll just bump up the file upload number”.
When I checked, the media library was already at 3GB of space…for a small site.
After blinking for a moment. I took a quick look at the files in the uploads folder and found that the culprit was the dozen versions of each image.
Whenever you upload a new photo, WordPress automatically generates the smaller version, or thumbnail, of the image. This depends on your media settings and the theme. Theses generated thumbnails have the image dimensions in the file name.
It’s not really practical to go through hundreds of files to remove these unused files manually, so it’s time to get some help.
The Life-Changing Magic of Tidying Up Your Site
Enter Thumbnail Cleaner. It actually requires Regenerate Thumbnails, so they work well together. It works by showing you how much space the thumbnails are taking up, how many files there are, and how much space you can save.
Note: I found that I needed to make a change to the code in order to see an accurate original size total. See my GitHub fork for details.
How to Declutter the Media Library
Thumbnail Cleaner deletes all the thumbnails, then lets you regenerate them all again from the original uploads. Since it does this, you’ll need to do this during a maintenance period and a good backup is highly recommended.
- Click the Analyze button.
- Remove all thumbnails
- Regenerate all thumbnails
In my case, it reduced the media library size by 30%. That’s something to consider the next time you change themes.
Priscilla Chapman
WordPress Developer, Web Support
Priscilla Chapman is a web developer specializing in WordPress working from Gainesville, Florida.