WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

get_user_by is the replacement for get_user_by_email:

$user = get_user_by( 'email', 'user@email.com' );
share|improve this answer
wonderful its done. Thanks a lot. – pixelngrain Oct 17 '12 at 6:41
one question how can I assign 2nd value (user@email.com) with dynamic variable so it will consider email for whoever login – pixelngrain 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; } – pixelngrain Oct 17 '12 at 6:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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