How to Login to WordPress using Email Address

Share This Article:

How to Login to WordPress using Email Address. WordPress allows users to login with their username only, which is not recommended in all cases. So as an alternative, using email address to login to your WordPress account is the best solution.

login-to-wordpress-using-email-address

Read This : 15 Best Syntax Highlighter WordPress Plugins

Login to WordPress using Email Address

Here are two solid methods that helps to login to WordPress using email address, do check them.

1. Using a Code Snippet

You will really like this piece of code written by Bavotsan, which works like a charm. Just follow the instructions and rest of the job will be done by this code.

Open your themes functions.php file and add this code in it.

function email_address_login($username) {
$user = get_user_by_email($username);
if(!empty($user->user_login))
$username = $user->user_login;
return $username;
}
add_action('wp_authenticate','email_address_login');

Now, here is another tweak which can be implemented at your own risk. As login page of every WordPress blog displays just “Username” its difficult for your blog authors to know whether they can use their email address or not. So we need to edit wp-login.php file which is located at www.yourblog.com/wp-login.php and follow these instructions.

Search for this code :

<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
</p>

Now Replace it with :

<p>
<label for="user_login"><?php _e('Username or Email Address') ?><br />
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
</p>

Voila, you are done with the editing part and now its time to test it. Also, remember that this code will be automatically replaced when you update your WordPress version. Hence, its recommended to bookmark this post for future reference. This part of code is via wpmods.

2. using WP Email Login plugin

If you don’t want to mess up with coding and don’t like to edit your theme files then here is the solution. Using a plugin is damn simple thing, just download and install WP Email Login plugin. Now, you can login to WordPress using your email address.

Download Plugin »

Check Out : Theme Furnace – Premium WordPress Theme Club

Hope, you like this simple snippet and many others will be added soon. Please do share your views in the comment form below and do subscribe to our feeds to get access to more snippets like this.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. Paul says:

    Hi just a thought instead of searching for the code username in the login file it will be better to use the gettext filter to search for this text just on the login page. This will mean that when you update WordPress you aren’t going to lose this change.

Speak Your MindComments Policy →

*

Looking for More Awesomeness?

Read previous post:
syntax-highlighter-wordpress-plugins
15 Best Syntax Highlighter WordPress Plugins

Ever find any difficulty in highlighting code in your blog posts ? Then these Syntax Highlighter WordPress plugins will help...

Close