WordPress: Enable Email Address Login & Change Login Page Text

Print View Mobile View

Drop this code snippet into your theme’s functions.php file to enable user login with email address, and also change login page text to inform about this functionality.

// login with email
function email_login($user_name) {
	$user = get_user_by('email', $user_name);
		$user_name = $user->user_login;
	return $user_name;

// Change 'Username' to 'Username or Email Address' on login page
add_filter( 'gettext', 'login_text' );
add_filter( 'ngettext', 'login_text' );
function login_text( $translated ) {
     $translated = str_ireplace(  'Username',  'Username or Email Address',  $translated );
     return $translated;

Login code via Bavota