12
Oct
2012

How to Login using email ID in WordPress

Posted in: WordPress No Comments

wordpress
By default WordPress allow users to login only using their username. But sometimes you may find remembering username little difficult, and remembering email ID easy.

In this tutorial I will show you how you can allow users to login using their email ID or Username on a WordPress website. Users can use either username or registered email ID to login.

Step 1:
Open functions.php file of your active theme in a text editor.

Step :
Add following code at bottom.

<?php
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 file. Done!!!

About the Author

Name: Ravi Shekhar
I love learning and sharing web stuffs.

Share this post

Twitter Facebook Google Buzz Digg StumbleUpon Delicious Technorati

Leave a Reply