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?

2

get_user_by is the replacement for get_user_by_email:

$user = get_user_by( 'email', 'user@email.com' );
2
  • one question how can I assign 2nd value (user@email.com) with dynamic variable so it will consider email for whoever login Oct 17 '12 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; } Oct 17 '12 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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