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?
https://ibb.co/CvBk4Ww
The issue may be with the data type so could you please tryvar_dump($email)
so it's data type can be checked, also if possible please share whole code so I can check this.