I have created an Image Upload field for a User Photo in the User Profile section in the wp-admin using Advanced Custom Fields. I realized ACF could do this per this post: Photo gallery on profile page?

How would I go about capturing the contents of the image src field in ACF? The following does not work:

<?php $publisher_photo = get_field('user_photo'); ?>

<?php echo "<img class='publisher-picture' src='$publisher_photo' />"; ?>

I even tried this, but it does not work either:

<?php $publisher_photo = get_the_author_meta('user_photo'); ?>
<?php echo "<img class='publisher-picture' src='$publisher_photo' />"; ?>

When I try to debug and echo the contents of the $publisher_photo variable, it comes back blank leading me to believe I'm not picking up this field from the User Profile in the correct way.

  • In addition, when I do some debugging, such as: <? php echo $publisher_photo; ?> This is not returning anything. The variable appears to be blank.
    – Matt
    Commented Jan 1, 2013 at 2:32
  • Thanks for this bit of code. Has worked perfectly... However do you know why it is cropping the image to 150px x 150px? Is it possible to display the original size? Thanks
    – user47333
    Commented Feb 8, 2014 at 17:03

2 Answers 2


Got it working! Here's what solved my problem:

$publisher_photo = get_the_author_meta('user_photo');
$image_src = wp_get_attachment_image_src($publisher_photo);
echo '<img class="publisher-picture" src="'. $image_src[0] .'" />';

Because it's not reading your variable $publisher_photo. Try <?php echo '<img class="publisher-picture" src="'. $publisher_photo .'" />'; ?>

  • That didn't work for me..Still shows up blank in the view.
    – Matt
    Commented Jan 1, 2013 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.