0
votes

I created a custom ACF Field called 'url' under the user registration data section which will carry the facebook homepage of the user . However when I try to use it in index.php template it is not working. It is showing no href link. I don't see anything wrong with the code.

     $author_id = get_the_author_meta('ID');
     $test=get_field('url', 'user_'.$author_id);
      ?>
    <div class="image"><a href="<?php echo $test; ?>" target="_blank"><?php echo $gravatar?></a>
    </div>
1

1 Answers

1
votes

You need to specify the id of user:

For example:

get_field('url', 'user_1');

This code returns the url field of user with id = 1