Created
October 28, 2012 07:35
-
-
Save simonlk/3967976 to your computer and use it in GitHub Desktop.
Allow user to login to Wordpress with their email address
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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