- WordPress by default does not allow registered website users to login using their provided email addresses.
However there’s a simple code that will provide all users of your WordPress blog or website the luxury of logging in using their email address or user name.
- Before you use this snippet, which is commonly used by many WordPress website owners, be aware that for a secure website, it is never recommended to let anyone else know your administrative login name, therefore if someone knows your personal email address which is used to login, they have a head start at figuring out your password. But then again, if you are use proper password guidelines you are statistically in good shape. We use it from time to time!
Copy and paste the code below into your functions.php folder.
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');
Sean Doyle
Sean is a tech author and security researcher with more than 20 years of experience in cybersecurity, privacy, malware analysis, analytics, and online marketing. He focuses on clear reporting, deep technical investigation, and practical guidance that helps readers stay safe in a fast-moving digital landscape. His work continues to appear in respected publications, including articles written for Private Internet Access. Through Botcrawl and his ongoing cybersecurity coverage, Sean provides trusted insights on data breaches, malware threats, and online safety for individuals and businesses worldwide.









2 Comments
[…] login.” Well – I have certainly not enabled email login to my WP site so I found an entry at http://botcrawl.com/how-to-login-to-wordpress-with-an-email-address/ which describes how to do that. Please note that I updated wp-includesfunctions.php (under t WP […]
How To Login To #WordPress With An Email Address http://t.co/t7RapuZ5 via @Botcrawl