Skip to content

Instantly share code, notes, and snippets.

@simonlk
Created October 28, 2012 07:35
Show Gist options
  • Save simonlk/3967976 to your computer and use it in GitHub Desktop.
Save simonlk/3967976 to your computer and use it in GitHub Desktop.
Allow user to login to Wordpress with their email address
// Allow users to login with their e-mail address
// source: http://www.benblanco.com
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');
function change_username_wps_text($text){
if(in_array($GLOBALS['pagenow'], array('wp-login.php'))){
if ($text == 'Username'){$text = 'Username / Email';}
}
return $text;
}
add_filter( 'gettext', 'change_username_wps_text' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment