Find Unused Images in WordPress

Cleaning up your media library and removing unused images can help you reduce disk space usage at your host, which could save you money. It also keeps the overall size of your site down, which will make backing it up and migrating it easier.

Whatever your motivation, getting rid of images you are no longer using is a great way to tackle this. But how can you find and remove unused images?

Don’t get unattached images confused with unused images and mass delete anything unattached. No, for this task you will need a slightly more sophisticated tool.

There are a few helpful plugins out there to assist. There are also some pretty useless ones. I tested several and I’ll let you know which ones to try out and which to avoid.

Helpful Plugins for Finding and Removing Unused Images in WordPress

These are my top 3, presented in order of recommendation:

  1. Media Cleaner (free and premium)
  2. Remove Unused Media (premium only)
  3. WP-Optimize (requires premium version)

I tested each plugin on 3 different sites of various sizes, complexity and hosts.

Accuracy

None of the plugins were perfect. Each one gave some kind of false result and the false results were different in each case. So you must use these kinds of plugins with an abundance of caution. Backup your site before you delete anything, and try doing a manual check to verify if an image is used or not.

Media Cleaner

There is a free version of the plugin which may work depending on your site, and a premium version with additional features.

According to the plugin information, the free version:

Checks if the media entries are used by the content (Posts, Pages and other Post Types, Metadata, Widgets, etc). Pagebuilders are only supported in the Pro Version.

So if you are using a page builder on your site, you will certainly need the Pro version.

The free version scans your media library and then checks to see if those files can be found within post content on your site.

The Pro version also has the following features:

  • Live content scan – this checks your site from the front end to do a more thorough check on files
  • File System scan – if you have uploaded media directly via FTP or any other way besides the media library, this scan will be helpful to determine if those files are actually in use.

In either version it’s possible for the plugin to miss something or produce a false result, meaning it states a file is not used, but it is actually used somewhere. So you should always back up your site and double-check the results carefully before deleting anything.

Pros

  • This plugin seems to be the best available option – even the free version provides a lot of value
  • Finds images in “WordPress” content like widgets, theme logos, in addition to post/page content
  • Results seem to be pretty reliable overall, give or take a few false positives.
  • There isn’t a ton of documentation, but there is a pretty thorough and detailed tutorial available
  • The premium price is very reasonable – at time of writing it starts at $29 for one site.
  • It adds a meta box on the media screen with information about where any given image is used, which I found helpful (see screenshots below)

Cons

  • Support is very limited even with the premium version. They do let you know that they only answer on Tuesdays and Saturdays but I waited even longer than that for a response (more than a week).
  • The user interface is not that intuitive, but it doesn’t take too long to figure it out
  • The scan was definitely a bit slow on a couple of sites, but worked reliably, you just need to be patient
  • The live content scan is an interesting feature and seems to reduce the false positives but even so you still have to double-check results.

Overall I think this is the most mature and reliable plugin of the bunch.

Remove Unused Media

Overall, I found this plugin a more intuitive to use than Media Cleaner. The interface sticks to a more native WordPress look and feel, so it already feels familiar. And there aren’t any configuration options, you just start the scan and wait for results. The scan felt a lot faster than Media Cleaner’s.

Remove Unused Media claims to support page builders like Divi, Elementor and Beaver Builder out of the box, although I didn’t specifically test page builder support for any of the plugins.

In contrast to Media Cleaner which only shows you unused images, Remove Unused Media shows you used and unused which I did appreciate. And on the Used tab it shows you exactly where and how the image is used.

Just like with the other plugins, there were some false positive results, which is to be expected. For example, unlike Media Cleaner, it didn’t detect that the logo image was in use by the theme, which was an unexpected point of failure.

The major issue that I had, and why I can’t wholeheartedly make this my top pick, is that on my main site, the scan wouldn’t run at all. There was no specific error messaging and nothing mentioned in the documentation so I was forced to contact their support.

Responses were a bit slow. After sending credentials it took over a week to get a response about the cause of the issue, which turned out to not be fixable. They told me it was due to a slow server but didn’t provide any more specific details. Mind you, the site in question is not even on a cheap, shared host. So this was pretty disappointing.

A contributing factor to my dismay is that it’s a premium-only plugin. So I’m expecting a fairly polished product, and effective support.

They did offer a refund and discount on their future update which should fix the issue.

So I wish I could wholeheartedly recommend this plugin, but the above prevents me. However, your mileage may vary so I think it’s still worth a try.

Pros

  • Fast scan
  • Clean interface
  • Works with page builders
  • Easy to use – no settings, just initiate the scan and that’s all

Cons

  • Slow support
  • Virtually no documentation
  • Won’t work on big or “slow” sites
  • Product doesn’t yet match premium-only model

WP-Optimize

WP-Optimize is free but the unused image detection part requires the premium upgrade.

It works pretty well overall but I personally don’t like “Swiss Army knife” plugins – that is huge plugins that do tons of stuff. Since I wouldn’t use WP-Optimize for caching or it other features, the idea of buying the premium add-on for one feature doesn’t sit well with me.

The scan seemed quite fast and the results are presented in a format like the Media Library. But the interface doesn’t give you as much information as the others. For example, you see how many images are considered unused, but it’s missing the file size.

So I will say that if you already use their free version, maybe it makes sense to give this one a go. If not, go with one of the other two.

Pros

  • Option to download a CSV file of the unused images
  • Option to check for unused image sizes
  • Fast scan
  • Pleasant interface

Cons

  • Not a standalone plugin, have to install the Swiss Army knife plugin WP-Optimize
  • No search feature in the image list – that could be problematic if you have a lot of results
  • The interface only shows you the number of unused images found, not their file size
WP-Optimize Unused image results

How to check if an image is used on your site

This can be a bit tricky and I don’t have a foolproof method, but you can try these:

  • Do a search for the filename from the front end of your site – if it’s in post/page content it should show up
  • Use a plugin like Adminer, or PHPMyAdmin in your hosting control panel to search in your database for the filename. This requires a bit of technical know-how to interpret the results so it may not be appropriate for everyone.

Plugins to avoid

Your mileage may vary, but I think any of the above are a better bet than the following:

Find Unused Images – On one site I couldn’t get it to work at all. On another it seemed to be working but kept coming back with an “incomplete crawl error”. They didn’t respond to the issue I posted on their WordPress support channel.

Ultimate Media Cleaner – This is incredibly un-intuitive, and in the end I couldn’t get it to work at all.

WPS Cleaner – This one seemed promising based on its feature set but ultimately it didn’t work at all on the two sites I tried. Other people had reported the same issue on their WordPress support forum, but there were no responses or solutions.

Weekly WordPress Tips To Your Inbox

  • This field is for validation purposes and should be left unchanged.