Support » Fixing WordPress » Scan for lost attachments

  • Eckstein


    Can anyone tell me what the “scan for lost attachments” function does in the media manager? Does it look at post content and see if attachments are broken or does it look for media without a post attached, or what?

    I can’t seem to find the documentation on it anywhere…

Viewing 4 replies - 1 through 4 (of 4 total)
  • halfspiral


    Me Too!! I am hoping it is a way to clean the media bloat you get with WordPress – especially old unused images, duplicates and the WP habit of making three versions of each image.

    I run a few WP blogs and help others with WP. People (who know no better) upload raw mega big digi-cam images which WP rightly resizes and optimisations. Of course, it means we end up with a load of surplus images clogging up millions of servers

    I came here because I was searching for a tool to auto clean these orphan images – I have a site that has 600MB of uploads but only uses a few of the 2000 images in the folder. I need to clear em out quickly rather than spend hours browsing through them all.

    As the most popular Blog Tool on the planet the mind boggles at the amount of server space and electricity being used to sort and store these surplus stuff.

    WordPress is a great tool but sometimes it really is a sledge hammer to crack a nut!! … it should come with it’s own media cleaner.

    COME ON WORDPRESS – Improve yours and our carbon footprint.



    does it look for media without a post attached

    From what I recall, yes.



    ESMI > Looks like you are right. Only half a job then as far as I am concerned!

    But a quick thanks to to those guys & gals you develop WO for free – you do a great job and made BIG difference to the web and people’s lives.

    Hmm. I just ran a couple of tests on this on 3.7 and it doesn’t seem to do anything at all.

    I uploaded a file into the uploads folder, clicked Scan. Nothing.
    I uploaded a file via the Media menu. Shows as unattached, of course.

    So I searched around online and there’s absolutely no documentation that I can find, anywhere.

    The only thing I found was a core Trac item where someone had optimized the scan. In the comments (here:, someone says:

    “Initially this scan was designed to catch attachments where the parent post is deleted, i.e. post_parent > 0 but post doesn’t exist, not orphan attachments with post_parent = 0”

    So, assuming this is correct, the “Scan” button ONLY looks for attachments where the post has been deleted, not files on disk which have no post or unattached attachments or anything.

    Given that WP should handle this situation anyway (by unattaching or deleting the media file when the post is removed), it’s pretty much a redundant waste of time, IMHO. It would be much better if it scanned the disk for floating files. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Scan for lost attachments’ is closed to new replies.