smzapp
smzapp

Reputation: 829

How to know the pages where an image is displayed in wordpress

I am not sure if this is possible since I've been googling about this issue but I couldn't find any solution. I am on media of wp-admin, and I am trying to view the pages where a specific image has been used. I am a developer and I don't know how it is done. Anybody help?

 Example:

 image.jpg

 has been displayed in :

 www.mydomain.com/

 www.mydomain.com/page-1 

 www.mydomain.com/page-2

I don't know how. Please help.

Upvotes: 2

Views: 3648

Answers (3)

Ahmad Essam
Ahmad Essam

Reputation: 1104

If you have access to the database, you can make a search for all occurrences of the image link in all posts and pages. To do this you need to get the link of the image through the admin menu. You will have something like:

http://example.com/wp-content/uploads/2016/03/image.png

The post and page content are located in the table wp_posts (Replace "wp_" with your table prefix if not using the default). Now you can do a query like:

SELECT `ID`, `post_title`, `guid` FROM `wp_posts` 
WHERE `post_content` LIKE  '%http://example.com/wp-content/uploads/2016/03/image.png%'

This will give you the post titles and their links. Should be something like:

ID  post_title      guid
9   Post Title 1    http://www.example.com/?page_id=9
20  Post Title 2    http://www.example.com/?page_id=20

Upvotes: 4

shubham shah
shubham shah

Reputation: 164

In Media change the view to List view where you will be able to see which image is attached to which post.

Upvotes: 0

Haninder Singh
Haninder Singh

Reputation: 618

All the images are uploaded under wp-content/uploads folder you will inspect using firebug and get the path of the image. Thanks

Upvotes: -3

Related Questions