wp_get_attachment_url( [postID] ); (2 posts)

  1. djprozac
    Posted 7 years ago #

    Hello all,

    I'm trying to display an attached image in my template. I'm using
    wp_get_attachment_image for tis, like so:

    <?php wp_get_attachment_image( $post->ID, 'full' ); ?>

    Unfortunately, it won't work: no code is returned.

    I have added the image inside the post, so it is now an attachment to that post, right?

    Is there a way access an attachment by URL? That way I can check whether the function should output something, or if the image I have added to the post doesn't register as an attachment.

  2. ianboo
    Posted 7 years ago #

    That Snippet is wrong: You have to give the attachment-id, not the ID of the post ...

Topic Closed

This topic has been closed to new replies.

About this Topic