Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Which function can be used to get the user's object using the username? I've tried get_userdatabylogin() but the function seemed to throw an error:

Parse error, unexpected T_STRING on line xx

The function was called like so:

get_userdatabylogin($username);

share|improve this question

1 Answer 1

up vote 5 down vote accepted

That function should do what you want. Are you sure the error is not elsewhere?

You can also try using the get_user_by()(source) function:

$user = get_user_by('login', 'MaryJane');

This is the same as get_userdatabylogin('MaryJane');

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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