WordPress.org

Ready to get started?Download WordPress

Forums

Get author image attachment URL on post page - I get ID but not URL (2 posts)

  1. Pete
    Member
    Posted 1 year ago #

    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

  2. nghoanghiep
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic