Tidying the Media Library With WP Ninjas’ Remove Unused Media Plugin

A few weeks ago, WP Ninjas announced it was stepping into the media optimization plugin market. The team released its Remove Unused Media plugin as a commercial project for tidying storage space. I received a full copy of it and put it through the ropes.

With so many commercial plugins, I am accustomed to the developers creating an entirely new menu item, taking up precious admin real estate. This happens even with those that just have a single screen too. However, I was happy to see the WP Ninjas team tucked everything neatly under “Media” as a sub-menu. We were off to a good start, and things only got better.

When I review plugins, there is one thing that I consistently preach: simplicity. That begins with following the core WordPress UI and sticking as closely to it as the plugin’s features will allow. In essence, don’t make me think about how to use your plugin.

For the most part, Remove Unused Media got the user experience right.

I could nitpick a few design choices with the interface, such as modifying the list table with rounded corners and extra padding. The “filter” sub-navigation also deviates from the standard. And, the “last analysis” message should receive the WordPress admin notice treatment so that it stands out.

These are all core UI elements with unnecessary customizations. However, they did not diminish the experience on the whole. The plugin mostly stuck with the WordPress standard.

The real question is whether the plugin does what it says on the tin. What is the experience of removing unused media like?

It was easy. Users merely need to click the “Start Analysis” button and wait a few seconds. The plugin then has three tabs:

  • Unused Media
  • Used Media
  • Ignored

The Unused Media tab presents an overview of all media that the plugin could not find used on the site. There is a possibility that it missed something. However, I only found one old-school scenario where this happened, which I will dive into later.

Screen that shows media that the plugin detects as unused. Attachments presented in a list table.
Unused media screen.

From this point, end-users can manually delete individual media attachments or use the bulk-delete option. Before doing so, the plugin recommends making a backup of the site — solid advice for any such plugin.

My favorite feature of the plugin was not its primary feature of deleting media. It was actually the “Used Media” screen. Its “Where?” and “How?” columns break down where images, videos, and other files are used and in what context.

Screen from the Remove Unused Media plugin that shows media where and how it is used across the site.
Used media screen.

It reminded me of the “instances” screen for the WordPress admin block directory proposal from 2019. The concept showed where specific blocks were used across the site. Remove Unused Media does the same thing for media files.

The “Ignore” tab for the plugin keeps track of media files that should not be deleted, even if they are unused. Users can click a link from the other screens to add them to the list. This persists after running a new analysis too.

The plugin scans several third-party plugins like Elementor, Beaver Builder, ACF, and Yoast SEO. Some store media instances outside of the post content, such as in custom post meta, and Remove Unused Media searches those specific fields.

Pricing starts at 39€ ($45.38 at today’s exchange rate) for one year of support and updates for a single site. It also has a five-site option at 149€ and a 100-site tier at 299€.

For the first version, the user experience felt solid. However, it does not have much in the way of customizability. That could be a sticking point for users who are looking for a more flexible premium option.

Exploring Alternatives

The plugin is not the first of its kind. The Media Cleaner plugin by Meow Apps is free, routinely updated, and has over 40,000 active installations. It also has a commercial version with more features, such as third-party plugin integration, WP-CLI support, filesystem scan, and live-site analysis.

The issues list from the Media Cleaner plugin in the WordPress admin, showing a list of unused media items.
Media Cleaner plugin results.

The UI for Remove Unused Media feels more like WordPress. Its “Used” tab also shows where (i.e., what posts) and how (e.g., content, featured image) specific media files are used across the site. This feature alone makes it worthwhile for me.

One area where Media Cleaner shines is its option for ignoring (not deleting) attached media. This is a vital feature if users have ever added the old gallery shortcode. At one point, WordPress simply displayed all attached images as a gallery. Eventually, it specified the IDs in the shortcode. However, for those older instances, this was not the case. Without enabling this option, those media items might get queued up for deletion.

The Remove Unused Media plugin does not have such an option. Attached images that are not explicitly used are considered unused. This may not be an issue for most users, but those with old gallery shortcodes should be aware of potential problems.

The baseline features for both are similar. Remove Unused Media gets the edge in its default user interface and experience. However, Media Cleaner has many more options for customizing how the plugin works. Plus, users who cannot afford an upgrade can always run the free version.

This is not to say either is better or worse than the other. Both were solid options in my tests. I just want to merge the best features from each, snagging the interface from Remove Unused Media and the configurability of Media Cleaner.

10

10 responses to “Tidying the Media Library With WP Ninjas’ Remove Unused Media Plugin”

  1. John says:

    There is also another 100% free alternative that I always use and that works really fine – Find Posts Using Attachments:
    https://wordpress.org/plugins/find-posts-using-attachment/

    Report

  2. calm says:

    This is a problem that needs to be solved in core, but it is nice to see that there are plugins trying to solve it. Still, searching the DB, which is most likely what the plugin does, is an incomplete solution like your [gallery] example shows.

    What is realy needed is to search usage in the generated HTML, this will help compatibility with more plugins, especially those that store the attachment ID instead of the URL. It still not going to be enough for attachments used on admin side.
    Maybe it should use the webserver log as a real life indication for what is used.

    But the real question is, what is the use case, and since it is a paid plugin, what is its ROI? storage is cheap and the amount of work that will go into verifying the images most likely will cost more than the extra cost of the storage.
    Maybe the “find where an image is used” part is worthy even if can’t be 100% complete, the “remove” part probably pointless.

    Report

    • Hey calm,

      You are right, this is a problem that should be solved in core. However, solving it in core will only work if every plugin adheres to the standards defined by the core. As this is highly unlikely to say the least, there will always be heaps of plugins that use attachments that would not be detected by such a core feature. This is where Remove Unused Media shines, as it does not rely on any standard way of including attachments. Unlike your assumption, it does not just search the database but checks the generated HTML as well. It checks portions of the database, the generated HTML as well as some special locations to find as many media usages as possible without false positives or taking hours. An actual real time solution is in the works.
      Checking the webserver log does not work in many cases. Imagine a post that is rarely viewed, the included media files would be marked unused and get deleted.

      Storage is cheap, but speed and time are invaluable. A cluttered website reduces productivity and speed. True, for most people the ROI of Remove Unused Media is not measurable, but once a site reaches a certain size cleaning up becomes a necessity, and this plugin saves you a lot of time and makes it much easier and less error-prone to do a real clean-up.

      Greetings from the Remove Unused Media team,
      Jonas

      Report

      • I can think of two real issues with a bloated media library:
        1. When browsing the library, the more items there are, the harder it is to find what you’re looking for.
        2. When backing up a site, either routinely or as part of a migration, media files take up the most space and therefore the most time.

        Report

        • calm says:

          @robert
          If you have so many unused images in your media library to have an actual performance impact you should ask yourself how did you get there.

          I would assume that most people do not upload images “just because”.

          @junas
          As I said I don’t think the plugin is useless, just that you emphesize the wrong functionality.

          The internet is interconnected and just because a image is not used on the site do not mean it is not used on other sites. Maybe you host it on one of your sites while using it on another. Maybe you use it in some public API integration (opengraph comes to mind, but also newsletters authored outside of the site are good candidates), so does anyone can be 100% sure that deleting an image has no impact? This is where the plugin needs to show its ROI as the effort in making sure an attachment can actually be deleted might not be trivial at all.

          The original problem here is that all attachments are public once they are uploaded and therefor you do not have an “not published” state for attachments that you could have used as signal that it is truly not used.

          Report

          • We typically see this with WooCommerce stores. Site owners rarely go back and delete images of deleted products. It adds up fast for stores with a high rate of change of catalog.

            Report

            • calm says:

              @robert, agree but for me it sounds like a call to a WC specific plugin (or a more genric one for when posts of any type are deleted) but it probably should happen when the post is deleted and things are still fresh in the memory of the admin, not 6 months later when it is hard to remember what was used where.

              Another posibility is to limit attachment usage to specific content and than automatically remove them when the content is deleted, but this is almost for sure something that require support in core.

              Report

  3. Miroslav Glavić says:

    This feels like it should be a core function.

    One of the sites I manage, has a weather page.

    (flag) (country name), click on the country name and it takes you to a list of cities.

    If Canada, it goes to a list of provinces/territories. If US then US States, if Croatia then counties.

    After you click on the Canadian provinces/territories, US States, Croatian counties and so forth, you get the cities.

    When in the middle list you get to see (country flag)(province/territory/state/county/etc flag), then when you get to the municipal lists you see (country flag)(province/territory/state/county/etc flag)(municipal flag) (city/town/village name) (weather icon/temperature).

    190-200 countries, Canada has 10 provinces and 3 territories, US has 50 states plus it’s dependencies/territories (like Puerto Rico and so forth), Croatia has 20 something counties. Other countries have 10+ provinces/states/departments/territories. Thousands of municipal flags.

    I think I have over 1,000 flag icons. Countless photos for articles (not just in weather content)….I had this specific site since 2000. 21 years adds up thousands of thousands of photos and graphics.

    I had to delete a few articles from time to time. I can’t remember the last time I cleaned up my media. I should but it is difficult to go through 50,000+ media files, I am sure it is closer to 85,000+.

    This should be part of core. Every 5 years I could do media cleanup.

    Report

  4. Ben Byrne says:

    Another alternative to consider is Media Deduper Pro, which can similarly identify unused media, as well as flag duplicate files and also identify images in the media library that don’t have default ALT values set.

    Don’t blame you for not mentioning it here since its “main” functionality is eliminating duplicate media files, but it definitely also addresses this need. (I can provide a free license if you want to check it out.)

    Report

  5. Brian O’Neill says:

    I find the biggest problem is WordPress generating unneeded image sizes. One uploaded image can have 6 different size files. Does it delete unused image sizes?

    Report

Leave a Reply to calm Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: