• Hi there:
    I’m trying to create a “Go back” link on an attachment page (image.php).

    Here is the scenario, in my post I have a hyperlinked image which links to an attachment page. From the attachment page, I want a link that says “Go back” which goes to the post the visitor was just viewing. The image itself is attached to that post, according to Media Library.

    Is there some function which determines the post to which an image is attached?

    I’ve searched the forum and seen people go the other way around, and find images attached to posts, but not posts attached to images. I suppose I could go the javascript route but I prefer to use a built-in WordPress function.

    Thanks in advance.

  • The topic ‘how to get post attached to image’ is closed to new replies.