1

If I wanted to get a custom field of the current user I would use something like this.

<?php echo get_user_meta($user_info->ID,'address_line_2',true);?>

This time however I want the author so I tried multiple version of the following to no avail.

<?php 
$thisauthorID = get_the_author_ID();

echo get_the_author_meta($thisauthorID,'address',true)
        ;?>

Any ideas?

Marvellous

1 Answer 1

2

get_the_author_meta() != get_user_meta().
Change to:
echo get_the_author_meta('address', $thisauthorID);

2
  • humm - not sure i get the difference. get_the_author_meta() defaults to the current user, unless the second parameter is defined. Where as get_user_meta(id) means the user id must be passed in. Is that the main difference? Commented Sep 6, 2012 at 16:38
  • I think get the author will default to the author of the current post object, not the current user. That's why you have to pass current user's id. Commented Jul 17, 2017 at 15:21

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.