WordPress login with Email:

WordPress is provinding login using Username by default. Sometimes we require userlogin by email also. So here is the code snippet, put this snippet into your current activated themes functions file.

[php]

add_filter(‘authenticate’, ‘qualitytuts_allow_email_login’, 20, 3);

function qualitytuts_allow_email_login( $user, $username, $password ) {
if ( is_email( $username ) ) {
$user = get_user_by_email( $username );
if ( $user ) $username = $user->user_login;
}
return wp_authenticate_username_password(null, $username, $password );
}

add_filter( ‘gettext’, ‘addEmailToLoginPage’, 20, 3 );

function addEmailToLoginPage( $translated_text, $text, $domain ) {
if ( "Username" == $translated_text )
$translated_text .= __( ‘ Or Email’);
return $translated_text;
}

[/php]

After adding this code, you can also use email as login name.