• Is there a way to display a list of all the posts an attachment is associated with (all the posts in which you can find the image on my website).

    I want to say for example ‘This image can be found in [post title A] and [post title B]

    I would also like the post titles to be wrapped in an anchor with the url of the post.

    This may or may not be possible? I look forward to finding out though, so that I can move on!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Each attachment will only be associated (attached) to one post. get_permalink($post->post_parent) will return the attachment’s parent Post or Page if used inside the Loop.

    Thread Starter surfsup74

    (@surfsup74)

    Thanks Esmi,

    Is there a way of showing multiple posts (if an attachment is used in more than one post)?

    No. WordPress only stores one Post/Page attachment per media file – usually the page that the file was first inserted into or the page being edited when the attachment file was uploaded. No further uses of the file are stored.

    Thread Starter surfsup74

    (@surfsup74)

    Ok – thanks for the heads up. I can now move on.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get a list of all the post associated with an attachment’ is closed to new replies.