Question: I must be doing something wrong, but the following commented code returns false. Note that WP is returning 'admin' as the 'user\_login', but when that user\_login is used for the `get_user_by()` function it simply returns false. Am I missing something?

```
$user = get_userdata(1); // (admin ID is 1)

var_dump($user->user_login); // string(5) 'admin'
var_dump(get_user_by('user_login', $user->user_login)); // bool(false)

```

I am running WordPress 4.8.2

Answer: 
I believe you'll need to use "login" rather by "user\_login" in the get\_user\_by call.

See the posssible accepted values of the function here: 
<https://developer.wordpress.org/reference/functions/get_user_by/>
Try this one it's working

```
$user = get_userdata(1); // admin ID = 1
var_dump($user->user_login); // string(5) 'admin'
var_dump(get_user_by('login', $user->user_login)); // return array with data

```