5

is it possible to sign in with user_email instead of user_login, please ?

Thanks.

1
  • You could build a plugin that replaces the username with the user email when they register.
    – Alex Older
    Aug 4, 2011 at 9:54

2 Answers 2

5

Here's how we do it:

$user = get_user_by('email', $email);
if (wp_check_password($password, $user->user_pass, $user->ID)) {
    // Login successfull, redirect if needed
    wp_set_auth_cookie($user->ID);
}

Assuming of course that you got the $email and the $password variables from a POST request or something :)

4

Search and you will find... WP Email Login

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.