Find where an image is used
WordPress does not show which pages use an image. Four ways to find out before you replace or delete it, from a quick search to WP-CLI.
Before you replace a logo, swap a product photo or delete old media, you want to know: which pages use this image? WordPress does not tell you. The Media Library shows at most one Uploaded to post, and that is only where the image was first uploaded — not where it appears now.
Why WordPress cannot answer this
An image can be referenced in many ways: an Image block in the content (wp-image-123 class and the file URL), a featured image, a WooCommerce gallery, a page builder’s layout data, a widget, a theme setting in the Customizer, a custom field. Each lives in a different place in the database, and WordPress keeps no central index of them.
Method 1: search your posts for the file name
- Open the image in the Media Library and copy its file name without the extension, for example
red-ceramic-mug. Without the extension, the search also matches resized copies such asred-ceramic-mug-300x300.jpg. - Paste it into the search box on Posts, then on Pages, then on Products or any other content type.
- Results list content that includes the file name. Divi 4 layouts are stored in the content, so they are found too.
What this misses: featured images, builders that keep layouts in custom fields (Elementor, Bricks, Beaver Builder), widgets and theme settings.
Method 2: check the obvious places
- Featured images: the posts list shows a thumbnail column in many themes; WooCommerce shows product images in the Products list.
- Appearance › Customize (logo, site icon, header image) or Appearance › Editor on block themes (templates and template parts).
- Appearance › Widgets.
Method 3: search the whole database with WP-CLI
If you or your host can run WP-CLI, one command searches every table, including custom fields and options:
wp db search "red-ceramic-mug" --all-tables
Search for the image ID too, for builders that store only the ID — but expect noise, because a number like 123 appears in many places. wp db search only reads; it changes nothing.
Method 4: a plugin that looks everywhere for you
ByteKeel PixTag Pro answers the question from two sides:
- Unused Media tells you whether an image is used anywhere at all — it checks featured images, attachments, the site logo and icon, the image’s ID in custom fields, and its file name in content, revisions, custom fields and options (which covers widgets and theme settings). See Find and remove unused images.
- Image Manager shows, post by post, which images each page uses — featured, in the content, inside Elementor, Divi, Bricks and Beaver Builder layouts — and lets you edit their alt text and titles. See Image manager and CSV.
Before you replace an image
To swap a picture everywhere it appears, the safest route is to upload the new file with the same name and dimensions in place of the old one (a media-replace plugin does this) — references by ID and by URL then keep working. Deleting the old image and uploading a new one breaks every reference you missed.
Frequently asked questions
What does “Uploaded to” in the Media Library mean?
The post you were editing when the image was uploaded. It is set once and is not updated when the image is used elsewhere or removed from that post.
Does an image count as used if it is only in an old revision?
WordPress will not show it to visitors, but restoring that revision would bring it back. ByteKeel PixTag Pro counts revisions as a use, to be safe.
Can I find images used on other websites?
Not from WordPress. If other sites or emails hot-link your images, deleting them breaks those too — keep anything you have shared publicly.
Why does search find an image in a post where I cannot see it?
It may be in a hidden builder section, a reusable block, a draft revision, or only in a link to the file. Open the post’s code editor or builder layers to find it.
Did this answer the question? No — open a support request