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

2

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

  • 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? – emeraldjava Sep 6 '12 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. – WraithKenny Jul 17 '17 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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