WordPress login with Email

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.


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;


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

Author: Dheeraj Dhawan

I'm a web developer / PHP programmer. I am also working on custom plugin development of wordpress.

One thought on “WordPress login with Email”

Leave a Reply

Your email address will not be published. Required fields are marked *