A photographer organises his photographs

WordPress: Remove unused images from your media gallery

There are a number of plugin options to reduce the webspace used by your website. If you already have a well groomed media gallery, then your best option is likely a plugin like Smush that optimises the images you already have. This will save you a lot of space, but not only that, it will really help your visitors get the best experience too, as page load times will be reduced.

My problem was a little different. We have inherited a number of websites from other web designers that have not optimised images before adding them to the WordPress gallery. Some images were 11MB! On top of this, it looks like there is also a plethora of different versions of the same file. So how do I know which one is safe to delete? I’m going to tell you how I reduced a site from 500mb, to 100mb in size. That means a quicker site, much smaller backups, less storage costs and reduced data transfer charges. It all adds up to a decent saving across a number of websites.

Finding unused images in your WordPress media library

In this step, I installed a utility by Meow Apps called Media Cleaner. The free version will look at your WordPress website and see if you are referencing all the images that you have in your media gallery. It will give you a handy list of those pictures it thinks you aren’t using and allow you to remove them. Note: It’s not clever enough to take a deep look when using page builders such as Kallyas or Beaver, but there is a pro version that will.

Now you may have the problem I did: what about a large WordPress uploads folder that has images that aren’t even referenced in your media gallery? You could upgrade the Media Cleaner plugin I’ve mentioned already to the pro version, or… use the Media Sync WordPress plugin. This plugin will gather all the photographs and images in your uploads folder and import them. Now you can use the Media Cleaner again to wipe out those that aren’t needed. Perfect!

Make sure you take a backup before you do any of this! And take another when you’re finished. You may be impressed at the reduced size of your backup file.


Posted by: Ian Brown
Ian is a Technical Lead for Iress, a global financial software leader. He is passionate about front end web development, enjoys coding in JavaScript & TypeScript and has the goal to make the web more accessible for those that are impaired visually or otherwise.

Did you appreciate this content? Did you find a typo? Do you have any tips that worked for you? Please leave a comment.

Click to share

Leave a Reply

Your email address will not be published.