I've been given the directive to "retire" about 1000 articles from a wordpress site I maintain. Deleting the posts from the DB is trivial, but how would one go about deleting the orphaned files from the uploads folder?

  • I used php to delete the attachment files inside the folder. – Ari Nov 24 '13 at 8:20

Try plugin called 'Media Cleaner'. It's seriously made (the author, tigroumeow, mention 5+ time "do a backup before use") + upload Janitor was last time updated 10 years ago.

| improve this answer | |

take a look at Upload Janitor plugin. its a plugin i use to clean up unused images and other files from your uploads folder.

but just in case make a backup of your uploads directory first

| improve this answer | |
  • That's the one. I knew there was something like that. Thanks! – Dan Gayle Jan 31 '11 at 19:31
  • Interesting plugin. It seems to be dealing with the backup thing as well - taken from the plugin description: "Before any action is taken, Upload Janitor will automatically make a 'tar' archive of all files to be erased, including their original paths, so you can restore if necessary." – Michal Mau Jan 31 '11 at 19:59
  • glad i could help :) – Bainternet Jan 31 '11 at 20:36
  • Any ideas for a suitable replacement to upload janitor for Wordpress 3.0+, given that it doesn't support WP3? – user16797 Jun 6 '12 at 14:06
  • 1
    @rilwis No. From the looking at the source, it looks like the plugin only considers images included in the body of posts.It doesn't look for post thumbnails ("featured images"), for custom meta values, or for references to images in your stylesheet. Though I'd say that images referenced in your stylesheet are better kept in your theme directory, rather than your uploads dir (I assume that stylesheet references are what you mean when you talk about slider, social icons, etc.). – MathSmath Jun 6 '12 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.