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.

Buy the Pro version

Get Media Cleaner Pro

  • 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 (https://wordpress.org/plugins/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?

    • Can you see the Meow Apps Menu? In there, there is Media Cleaner, and you should be able to see this field right away.

  • 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…

  • Christian Fischereder

    Hi Jordy,
    you write “Visual Composer is not supported as for now…”
    Will the MediaCleaner be extended to detect also files used with Visual Composer?

    Many thanks in advance!
    BR, Christian

    • Hello! I would need to work for a few days on the plugin so it’s a bit difficult to do right now unfortunately 🙁

      • Christian Fischereder

        Hi Jordy, Just for the info, it would be quite possible for me to pay a working day officially. And it does not have to be immediate … BR, Christian

  • David Jeffries

    Hi Jordy,
    I have added the line define( ‘MEDIA_TRASH’, true ); to my wp-config but still it saying to add it? should it disappear once I have added this line to the config file?

    https://uploads.disquscdn.com/images/c1d4ffcdbf24c31b3eff9f08d4f1e885d660f0b48aae039feb5c2f2e8eb0dbfb.jpg

    • Hello! Yes, it should go away. Are you sure you put it in the right file? Or maybe your install is totally ignoring this for some reason, but I don’t see how that would be possible :/

      • David Jeffries

        I moved the line further up the config file and it accepted it, adding it to the end of the config file it doesnt work… Thanks Now to run it…

    • David Jeffries

      Ok, that response isnt very helpful… I’ve paid for the pro version, whyu isnt it working? its found 166 unused images ((apparently) a good thing with 2000 images on the site, however I cant safely delete them as there is no trash option, help?

      • Sorry, it’s hard to tell you why the trash function is not getting enabled, it’s actually not part of my plugin, it’s part of WordPress. My plugin simply tells you that it is not enabled. It’s not safe to delete them, but of course you could check if they are indeed not in used yet; I can also try to access your install and see why if this is really not enabled, but if you update your wp-config.php accordingly (by adding this line at the end) it should really really work. I really want to help but the best I can do is to have a look at your install. Contact me directly if you wish me to have a look.

  • Hello!

    How do I get the plugin to search and analyze images in the background using CORN?

    • Hi, you mean with CRON? 🙂 It’s not possible currently. To be honest, it’s usually not good to do things through CRON in WordPress as it’s not really a real CRON and there are many cases where it will not work nicely. The cleaner is a process better watched closely, in a tab.

  • Jodi Solbrig

    I’m trying this plugin out, but I get “Preparing medias (0 media)….

    Everything else, seems to check out fine. Any ideas for me?

    No errors in apache2 logs.

    Checked server processes, doesn’t seem to be doing any work.

    have let it sit for 15 minutes with no changes. We do have a very large inventory of media.

    ideas?

    Would be happy to purchase if it works and does the job!

    • It might be that your install is too huge and that even can’t run a simple query to get all the IDs of all the media. If that happens, it gets real tricky to get it to work unfortunately. Contact me through https://meowapps.com/contact/ and I can try to have a look.

  • Larry

    Hello, Jordy… I purchased the pro version of Media Cleaner. Like a few others who have posted here, I simply cannot get it to do anything. It’s activated with the serial key and I’ve used your recommended settings. No PHP errors. When I click on Scan, nothing happens. I’ve let it sit overnight, but still no results. I really want this plugin to work… if you have the time, I’d really appreciate your help. Thanks in advance..!

    • Hello! Don’t worry, if it doesn’t work for you, I will refund (I don’t need a reason even). But I would much prefer to make it work and to understand what’s happening. Nothing happens… at all? It’s not analyzing or scanning? Did you check your Developer Tools in your browser to see if there is a JS or Network error? Contact me directly here: https://meowapps.com/contact/. I can have a look by myself and improve the plugin if there is something more I can do 🙂

  • Josh Wolcott

    The free version is picking up all my woocommerce gallery images as unused. The product image it sees as used but lists all gallery images as unused. Does the pro version have woocommcerce support or am I just doing some thing wrong?

  • Mattias B

    It would be nice if you could choose which directories the plugin scans when using the filesystem method. Can I do this programmatically?

    • You can’t do it easily, however you can already choose which directory to skip in the core.php file (/meowapps folder). There is a variable called “$wpmc_exclude_dir” and you can add the directories you want to skip.

  • Adnan

    so in woocommerce when deleting any product the images will still show up in the media library, can the plugin detect those images that are not attached with any product and remove them ??

    Thanks

  • JDMov

    Hi,

    3 times I’ve tried to purchase MediaCleaner pro, and every time I get taken to the Paypal site, I log in, then it just sits at my ‘Account Overview’ page and does nothing.

    Just a heads up for you – you might be missing sales.

    • I removed those pending sales (failed) and I am not sure why it is happening, indeed I could find them easily because there were the only sales with a pending status today. I have no idea what it is happening and it might be hard to debug too. The alternative would be to use credit card directly.

      • JDMov

        Thanks 🙂 Will do

  • Andrei

    I would be happy to purchase the pro version but i am trying the free one first.
    Just wondering why it’s so slow to scan and delete files/move to trash?
    I have a woocommerce website with 500 products and the scan takes hours to complete.
    And then when i stop it and or completes it takes even longer to delete the media or move it to trash. Deleting 5 takes 30 seconds, at this rate deleting 2000 would take hours. Often hangs and need to refresh the page and start the delete again.

    There are 2,123 issue(s) with your files, accounting for 784.45 MB.

    Deleting the 2123 issues would take 2-3 hours at this rate and i have a pretty fast hosting.

    It is normal to be this slow?

    • It depends entirely on your server, you can try the plugin on a local install with some data, normally that is very quick. Actually 500 posts/products it not much, maybe your hosting service is not very fast? The fact that it sometimes hang is a proof that the process is sometimes too slow and get stopped by PHP. Depending on the options you picked the plugin perform a lot of checks, and unfortunately there is no way around.

  • Rüdiger Robin Flothmann

    Hello Jordy, I bought the licence, but do not get it to work. It always says: Internal Server Error. Can you help? Attached 2 Screenshots of the Options. https://uploads.disquscdn.com/images/262ff3c3f16914d96caa1501c60f727a01d2c3e51c5309a1f9cc1957aeddcb3a.png https://uploads.disquscdn.com/images/b5d00df7e7b14e15e13b61f7126727ae946ebbc787728b123114bc11ecec11c9.jpg

    • Hi! Can you contact me directly here? meowapps.com/contact/

      • Rüdiger Robin Flothmann

        I tried with Safari and Firefox: cannot send a message there: Failed to send your message. Please try later or contact the administrator by another method.

        • That’s odd 🙁 I can try to contact you instead, but I don’t find your name in my store, can you give me your first name or last name, and when you bought the plugin approximatively?

          • Rüdiger Robin Flothmann

            Okay, thank you! I bought it on 03 Aug 2017. Name is (after marriage) new Bodmer at the end. E-Mail-Address begins with rb@ich…

  • joefry

    Just a note of thanks to say it works great and as expected! I had a little confusion whether I was deleting individual files or the whole batch, but managed to figure it out. Analyze, delete and trash all worked very fast for me. I’m looking forward to using the media tool in WP/LR sync (which is a godsend to anyone working in Lightroom) to organize the stray image puppies that weren’t destined for galleries.

  • Hi, i have deleted all the files which are not in use using Media Cleaner. Now my website has lost many important files. Could you please let me know how to recover those files back?

    • Hello! Why you didn’t make any backup? It’s written everywhere (description, warning messages, tutorial) that you must make one. Then that you need to be careful in general. Also, did you try the Restore function from the trash?

  • Bruno Roche

    Hello,

    Your plugin sounds promising. I am currently using a plugin called Sensei developped by WooTheme to do e-learning. I’ve installed your plugin on a staging version of the website using WP staging plugin.
    I’ve run a scan and I got many media detected as unused which are actually used (I tried to delete couple of them and no longer have access to them through http protocol (front or back-end)). I’ve also double checked that the path for these media are actually recorded “clearly” in the db in the post or postmeta tables. I am then unsure why your plugin detects them as unused. Just wanted to let you know so that you can improve this plugin!
    As a side note I am running the scan on the production server see if the problem comes from the WP staging plugin. I’ll let you know.

  • Shane C Bell

    Will this work with Multi Site?

  • Just bought this and when I scan no results. When I try to save the ID for pro it saves it but after scan it shows up as if I never entered it. I’m going to try and work with it a little more to see if I can get it working. For now I’m just giving you a heads up just in case I need a refund.

    I’ve turn off all the caching. did not make a difference. And I enabled that utc thingy just in case me server did not like using that. Still same problem. Does the plugin require openurl to be enabled? Because even though it is, some plugins think it’s not. Have not been able to figure out what causes that and my host is not much help.

  • Bruno Roche

    Hello Jordy,

    I saw you erased my last comment regarding Sensei and your plugin. Is there a way you can pm me so that we can discuss the matter? I’d love to see the plugin working on my site.
    bruno [at] airammontessori.com

    Cheers and Thanks.

    • Hi, for support it is really important to go through https://meowapps.com/contact/. I am trying to keep the comments here as a FAQ or general questions.

      • Bruno Roche

        No Prob Jordy but it was more a comment for you than a support question so that you can improve your plugin that needs to work with Sensei.
        I’ll post on the WordPress.org forum then.

  • hdscarbro

    Here is the license link that you requested for the transaction refund. https://meowapps.com/?mkey=I-F4JB85JD741L

    • I did the refund. Can you confirm? Then I will delete the comments, this kind of exchange shouldn’t appear in public 🙂

      • hdscarbro

        Yes. The refund was received. Thanks.

      • hdscarbro

        Sorry I couldn’t find an email address anywhere.

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