Log in to WordPress using an Email Address

Posted In Web Development - By On Wednesday, December 28th, 2011 With 0 Comments

I needed to figure out how to allow a user to use either their username or email address to log into WordPress. It took a bit of rooting around but the final piece of code ended up being pretty simple.

function login_with_email_address($username) {

	$user = get_user_by_email($username);


		$username = $user->user_login;

	return $username;



Place that in your functions.php file and you will be able to sign into your WordPress site using an email address or by default, the username.

Log in to WordPress using an Email Address

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>