JDM Digital

Login to WordPress with Email

Here's an easy way to let your WordPress users login using their email address and password so they don't have to remember their username. Just add this to your theme's functions.php file.

We don’t know about you, but we have literally thousands of logins to manage and it’s hard enough to remember your password–much less your username.  Here’s an easy way to let your WordPress users login using their email address and password so they don’t have to remember their username.

All you have to do is locate your functions.php file (located in your theme’s directory).  So that’s something like wp-content/themes/yourtheme/functions.php.  Then, add the following line of code to that file.  We like to add it towards the bottom of the file.

// login with email
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');

Save and upload your functions.php file and you’re all done.

Users can now login to WordPress using any login form (the wp-login.php form or something like Login With Ajax) using their email and their password (no username).

They can still use their username and password–if they really want to.

Get the Email

Join 1000+ other subscribers. Only 1 digest email per month. We'll never share your address. Unsubscribe anytime. It won't hurt our feelings (much).

Subscribe

Exit mobile version