Support » How-To and Troubleshooting » wp_get_attachment_url( [postID] );
7 years, 9 months ago
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.
7 years, 6 months ago
That Snippet is wrong: You have to give the attachment-id, not the ID of the post …