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

How can i allow users to login to my wordpress site using both email id and username? Currently it is allowing only username.

share|improve this question
Sorry, plugin/theme recommendations are off topic here. Try the WordPress group on Google+ or wordpress.org forums – Bainternet Mar 11 '13 at 13:21
up vote 9 down vote accepted

Here you got a small plugin. If you don't (or can't) use a plugin, this should - in theory - as well work from within your functions.php file. Just leave the plugin comment header out.

/** Plugin Name: (#90328) Login with E-Mail address */
function login_with_email_address( &$username ) {
    $user = get_user_by( 'email', $username );
    if ( !empty( $user->user_login ) )
        $username = $user->user_login;
    return $username;
add_action( 'wp_authenticate','login_with_email_address' );

Hope this helps.

share|improve this answer
I edited your question as this is plugin territory and shouldn't be part of a theme. I left your statement in, but offered it as plugin as well. – kaiser Mar 11 '13 at 13:25

This now a default feature of WordPress 4.5, so the custom plugin or function is now not needed.

share|improve this answer

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.