I am getting people's first and last names this way:

$_UFName = get_user_meta($_uid, 'first_name', true);
$_ULName = get_user_meta($_uid, 'last_name', true);



is the persons id I pulled in a query from the users table.

How do I get their username? this code:

$_UUName = get_user_meta($_uid, 'user_login', true);

that is not working. It is blank.

Is there a way to get it from the user meta?

thx, Richard

1 Answer 1


The username is not a user meta entry, so you'll probably want to work with a WP_User object instead:

$user = get_user_by( 'id', $_uid );
echo $user->user_login;
  • Oh, duh. LOL sorry about that. Stupid of me. Should have slept before working on this.
    – Richard
    Apr 3, 2016 at 12:45

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.