Find Posts Using Attachment

Description

Allows to find all posts where a particular attachment (image, video, etc.) is used.

Adds a “Used In” column to the list view in Media Library, as well as to the attachment details modal.

Finds posts that use the image (including any of its intermediate sizes) in post content, or as a featured image. Works with custom post types too.

Inspired by a WP Tavern post on image attachments.

Screenshots

  • “Used In” column in Media Library
  • “Used In” column in the attachment details modal.

Installation

  1. Upload find-posts-using-attachment folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.

Reviews

August 25, 2019
The plugin let me find posts and pages associated with an image so I could delete duplicate images. To use on Multisite, I installed on the main site and activated on the subsite.
April 19, 2019
Really useful for tracking down where attachments have been used. Only two drawbacks I've found is that (1) it seems to look quite narrowly at the contents of posts and their featured images, rather than across a site more broadly, (2) on my site (with over 8,000 images and over 10,000 posts, to be fair) it slows down the backend very considerably.
February 9, 2019
The idea is very smart! It does not find all the pictures (for example it fails with those used in a landing page built with a third part plugin, or with images not loaded in a specific page, as the logo or the default title image uploaded in a theme-dependent location). But it works great for pictures actually loaded in a specific page or article, also (as of today 9.2.19) in WP-bakery elements. Thanks!
December 17, 2018
I was pulling my hair out looking at raw database dumps lamenting the fact that WordPress does not bake in a way to see where each media asset is used. Then I thought, "There must be a plugin for that," and found this, which works great for me. One thing I notice is that it does not work on some early posts and imported posts. For me this was about 6-8 images out of 400. Those were easy enough to track down. There are a few more it won't find because they aren't in the database - the image on my custom 404 page, for example. Here again, I wish that WordPress would just do like Drupal and let you create a regular page and, in the settings, designate it as a 404 page (Drupal has methods for keeping the server load light for 404s even though they are full pages). But, since it's hardcoded and that info is not in the DB, obviously no plugin can figure that out. So to those who are saying it shows some or a lot of unused images, that's probably a result of the way your images are added to posts. When I looked at posts that I knew used images that where flagged as unused, all I had to do was add the image again, using the standard Add Media button and this plugin instantly picked it up. So, yes, it did not catch 100% of the images. Still, for me, this has been a huge time saver. And guys... it's free. Volunteer labor created this. Thanks Sergey!!
October 18, 2018
Wow!!! Thanks a million for this great plugin to its author Sergey Biryukov!
Read all 18 reviews

Contributors & Developers

“Find Posts Using Attachment” is open source software. The following people have contributed to this plugin.

Contributors

“Find Posts Using Attachment” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “Find Posts Using Attachment” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0

  • Initial release