0

I tried to find replacement function for get_user_by_email($email) but no luck. This function I am using to allow user to log in by email address or user id. Is there any replacement function or alternate way to do that?

1 Answer 1

3

get_user_by is the replacement for get_user_by_email:

$user = get_user_by( 'email', '[email protected]' );
2
  • one question how can I assign 2nd value ([email protected]) with dynamic variable so it will consider email for whoever login Commented Oct 17, 2012 at 6:43
  • here is my function. will it work properly? function login_with_email_address($username) { $user = get_user_by( 'email', $user->user_email ); //$user = get_user_by_email($username); if(!empty($user->user_login)) $username = $user->user_login; return $username; } Commented Oct 17, 2012 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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