WordPress.org

Support

Support » How-To and Troubleshooting » Get author image attachment URL on post page – I get ID but not URL

Get author image attachment URL on post page – I get ID but not URL

  • I’m using advanced custom fields plugin and have setup an image field for my users to add an image in their profile. I need to display this image on post pages, so i’ve tried the following…

    <?php
        $attachment_id = the_author_meta('author_logo');
        ?>
        <?php echo the_author_meta('author_logo'); ?>
        <?php wp_get_attachment_image_src( $attachment_id )?>
        <?php wp_get_attachment_url( $attachment_id ); ?>

    The output is always the image attachment ID never the URL. What can I change to output the image path URL?

    Thanks

Viewing 1 replies (of 1 total)
  • You can use: wp_get_attachment_url(), for example:

    wp_get_attachment_url(get_post_thumbnail_id($post->ID))
    to get featured image

    I’m sure it returns url

Viewing 1 replies (of 1 total)
  • The topic ‘Get author image attachment URL on post page – I get ID but not URL’ is closed to new replies.