admin管理员组

文章数量:1122846

I'm trying to return user data based on an email input, code is simply:

$email = '[email protected]';
$user = get_user_by( 'email', $email );

This returns nothing and when I try filter_var($email, FILTER_VALIDATE_EMAIL) it tells me that the email isn't valid.

When I hard code the email into the function it retrieves the information correctly:

$user = get_user_by( 'email', '[email protected]' );

What am I doing wrong in the first code snippet?

本文标签: Get User By EmailNot Working with Variables (PHP)