Created
May 2, 2013 09:06
-
-
Save michaeloeser/5501082 to your computer and use it in GitHub Desktop.
Login into WP with your email address instead of your username
This file contains 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
<?php | |
/** Plugin Name: (#90328) Login with E-Mail address */ | |
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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: http://wordpress.stackexchange.com/questions/90328/email-address-or-username-used-to-login-in-wordpress/90329#90329
Makes sense to pack it into a plugin. But you can slo add that to your functions.php file