Home Forums General Issues Cannot access user fields via PHP?


Cannot access user fields via PHP?

  • I have the following code;

    $author_id = get_the_author_meta('ID');
    $user_login = get_field('user_login', 'user_'. $author_id );
    echo '<span class="bmm-post-meta-item bmm-post-comments-number"><a href="">' . $user_login . '</a></span>';

    When I echo $author_id I get the ID, everything seems to be right until here.
    But when I echo $user_login it echoes noting.

    But I tooks this pretty much straight away from the documentation.

    What am I doing wring here?

  • Your code looks good. From what is provided the only thing I can think of is that the issue is with the field.

    Is “user_login” a sub field or a group/repeater or flex field?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.