Media Cleaner

Delete unused files from WordPress

Do you run a popular website about WordPress, photography, or do you have another way to talk about my plugin? I can share a free license against some promotion of my plugins. As you might know, I don’t do any marketing, I prefer to focus on quality and support πŸ™‚ If you are interested, contact me

Media Cleaner is a tool that detect unused and useless files from your WordPress. It cleans clean your Media Library and your Uploads Directory.

Media Cleaner for WordPress


You can choose to check your Media Library or your Uploads Directory. Then the plugin will check if the file (or files, in the case of a media) is used anywhere in your WordPress install depending on the options you have chosen. Here are a few examples of what can be checked:

  • physical file not linked to a media and/or to anything else
  • the media not used in any posts and/or anything else
  • the media is not used in any gallery, postmeta
  • the Retina image is an orphan, the normal file is gone
  • etc…

Basically, by playing with the options, you can discover a lot about how your system is used and how much (in term of weight) of images became useless.

Media Cleaner Settings

The files (or media) is then added to the Media Cleaner Dashboard. From there, you can choose to move then in the trash. The next step is to test your website, maybe for a few days or more; if nothing is missing, if all is working well, it means none of those images were actually in use. Then you can decide to trash them completely.

Even if the plugin is on the safe side and has this trash system included, make a proper backup before using it. If you don’t really know what you are doing, simply do not do it.


Personally, I have one website on which I use my images in posts only ( I set the Method on Media Library and the only options I check is “Posts”. I usually get very interesting results of Media I actually don’t use or stop using.

I have another website which is all made with galleries (WP Gallery). Again, I use the Media Library method but this time I only check “Galleries”. I realized this way that there are images I forgot to include in my galleries.

The way I love to use this plugin is every time I switch theme. When I do so, I need to regenerate my thumbnails and my alternative images (with a plugin such as Regenerate Thumbnails) and by doing this you end up with a lot of new images being created; however, the old ones are still here! They aren’t registered in your Media Library (the Media exists, but the alternative size is not part of the metadata), it’s actually a mess. Media Cleaner is safe and will mark them as being used if you scan with “Posts”. However, there is a way to find those files which are actually disconnected from your WordPress. Method “Filesystem”, and check only “Media Library”. You will probably discover a huge amount of files which are completely garbage, but be careful, they might still be used in the “Posts”. You need to update your articles (that can do it by editing your posts, clicking on those images and edit, and Update; the HTML will be updated by WordPress with the proper alternative image).

Let me know how you use it, it’s always good to know πŸ™‚ Enjoy the plugin!


  • Pingback: WordPress Plugins A-Z #255 Media Library, Stopping Bots()

  • Flexicodes

    Question about your Media Cleaner plugin: Do you know if it works with the ACF plugin? Can it tell if the image is used within ACF fields in the WordPress installation? Thanks!

    • Good question! I am not using ACF myself but if this plugin is using post_metadata, which I guess it might be using, then it would work. But it’s better to make a test beforehand, just to make sure πŸ™‚ If you do, please come back here and tell us if it works. I will try someday as well.

      • Flexicodes

        Thanks, I’m a firm believer of the test, test and retest thought process so I will definitely be doing that for the client. I will check it out and let you know. It just seems that some of the WordPress generated Thumbnails started showing up in the clients Media Library which they don’t like because all of a sudden they are like 12 “extra/duplicates” of the same images showing up. I want to try to remove the thumbnails from the library and then regenerate them and hope that they stay in the background like normal. Hopefully your tool helps otherwise it might have to be a manual approach.

        • In that case, I recommend you to pick only the image sizes you need (maybe disable the ones you don’t need), regenerate the thumbnails (any of those plugins will not remove the old ones unfortunately) so that the metadata is clean, then run the Media Cleaner with the Filesystem mode, only with Media Library checked πŸ™‚ That way you will detect all the useless sizes image files. Let me know how it goes πŸ™‚

      • I am using ACF and I did a scan and its showing files that we are using, which are part of ACF related files field.

  • Awesome plugins you make! I have just purchased both Renamer, Retina and now Cleaner.

    But I have a little issue I can’t figure, so I hope you can help. I made a bulk generate in retina with all my images. It went perfect, but some days later I regenerated all images (with the Regenerate Thumbnails plugin), because I have changed the dimensions for large thumbnails from 1024px to 625px.

    Then I made a scan in Cleaner with the Filesystem method and the Media Library checked. It found a lot of images but not the 1024×512.jpg 1024×512@2x.jpg images!

    How do I delete all old images sizes?

    Is it better to use the other plugin Force Regenerate Thumbnails (

  • Mohamed M. Roushdy

    i am trying to use the Media Cleaner, but when I press scan, nothing happens. is this because “The trash for the Media Library is disabled. ” or this has nothing to do with it, and there is something else i am missing!

    • Mohamed M. Roushdy

      I am using WordPress 4.7.2 and a theme called Flatsome 3.2.5 and its Child Theme.

  • Inertia Interactive Media

    Where the heck is the field to add a serial number?

  • Eduardo

    Works with woocommerce images?

    • Normally yes, but WooCommerce has a lot of different features so it’s hard to say. It’s better to try and come back to me if there is an issue.

  • Hi – I just bought the Pro version of Media Cleaner – currently test driving… first impression is plugin is well engineered πŸ™‚ I have a possible suggestion for next-gen: an option to delete and redirect? BECAUSE if the image was ever in the wild and indexed by Google it will become a 404 in your Search Console. And / or maybe mark as 410 gone? Integration w Yoast / All-in-One? Love to hear thoughts of SEO mavens. Thx

    • Hi! Thank you for liking it, yes, a lot of thinking was put into it since it’s a hard plugin to make. So don’t hesitate to give me a little push with a good review on WordPress, that will balance the bad ones πŸ™‚

      Redirection is a very tricky subject as well, there are big plugins doing that, it’s not a tiny feature, so I can do that in the plugin itself. Of course, I could “communicate” with another installed plugin to take care of this. But to be honest, if a photo is not in use then Google should get a 404 on it, it shouldn’t be referenced anymore, otherwise it should be redirected to… what? πŸ™‚

      • Good point – in the case of a duplicate file (i have lots of those from changing thumb sizes) redirect – if the file is gone then rightfully it should probably be marked 410 I would think – but if the file is gone *what* exactly do you mark 410? This stuff gives me brain freeze πŸ˜‰

  • Thanks for making such a great plugin. I can’t install it though, it says that it doesn’t have a valid header. Using latest wordpress.

  • Jason

    Hi, where do you put the code to activate the PRO version? I find it is not very obvious.

    • Hello! In the Meow Apps menu in WordPress, then Media Cleaner πŸ™‚

      • Jason

        Ya it’s weird it’s not there and I downloaded the most recent ver.

        • From the WordPress Repo? Because that’s the Free version πŸ™‚ For the Pro version you need to use the link you got in your welcome email after buying the plugin.

  • I can’t get the plugin to scan for any files. This is driving me crazy. I just bought the PRO version…

I recommend you to use WPEngine or SiteGround. They are both excellent hosting services and work perfectly with all my plugins.