Skip to content

Instantly share code, notes, and snippets.

@michaeloeser
Created May 2, 2013 09:06
Show Gist options
  • Save michaeloeser/5501082 to your computer and use it in GitHub Desktop.
Save michaeloeser/5501082 to your computer and use it in GitHub Desktop.
Login into WP with your email address instead of your username
<?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' );
@michaeloeser
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment