WordPress Allow Login With Email

By Default WordPress do not let you to login using Email. Here, you can modify this behavior. Just add below code in your active theme’s functions.php file (Maybe if you are using child theme, put it into child theme’s functions.php).

add_filter('authenticate', 'customAllowEmailLogin', 20, 3);
function customAllowEmailLogin( $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 );
}

Now you can login with your email into WordPress.
Please leave your comments if its working or not working for you.

2 thoughts on “WordPress Allow Login With Email

I like to hear from you about this !!

This site uses Akismet to reduce spam. Learn how your comment data is processed.