Home » Blog » Cybersecurity » Cybersecurity » How To Login To WordPress With An Email Address (Enabling Email Addresses)
Using Your Email Address To Login To WordPress

How To Login To WordPress With An Email Address (Enabling Email Addresses)

Login To WordPress With Your Email Address

    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!

Down 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 engineer with over 20 years of experience in cybersecurity, privacy, malware, Google Analytics, online marketing, and other topics. He is featured in several publications.

More Reading

Post navigation

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How To Display Related WordPress Posts Without Plugins

How To Create A Shortcode For A Blank Or Empty Line On WordPress

How To Start A WordPress Newsletter