1

Is there a reliable up-to-date way to find media that resides on the server but is not used in the WP site?

I have found a number of plugins, but all are very old, with lots of negative comments to the effect that they do not work.

  • 1
    Attachments in the media library without a post_parent aren't attached to anything. You could run a wp_query with post type attachment and post_parent 0 to get a list of non-attached media. Something like that what you're looking for? – Howdy_McGee Nov 11 '15 at 1:20
2

Is there a reliable up-to-date way to find media that resides on the server but is not used in the WP site?

In short: no, not as far as I'm aware.

I have found a number of plugins, but all are very old, with lots of negative comments to the effect that they do not work.

The reason for this is that what you want to do is incredibly difficult, especially to do as a plugin or through automation. Consider this:

  • Uploaded images get stored in a YYYY/MM/image.jpg format
  • They also may get stored in multiple sizes
  • Their only reference to this file in WP is in the attachment meta data
  • Any reference in posts etc is through the attachment ID
  • This ID can be in several difference places

So, you would have to have a plugin that can match a file to an attachment ID, and then go through every possible field - and in a multisite installation every blog's version of those fields - and look for a reference to the attachment, and maybe then you would be able to have a result that you could use.

I can't really think of an easier way, but that process could probably be made a little easier with automation - it's just not something that you'll likely find a good plugin for.

0

The main problem is to define what is an unused image. Just because it is not associated to any post doesn't mean that it is not used by some external entity that you care about (image included in news letter).

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.