Skip to Main Content

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.

Share the love:

Get Support

Nobody's perfect. If you need a little help, request support from the super-nerds at JDM Digital.

Any information you provide here will be kept confidential and only used for this purpose.

So we can follow-up.

The URL of the issue.

The more specific you can be, the better.

I am 100% robot

You're not a robot, are you? Sorry we have to ask.