How to allow users to login using email

September 8, 2015 5:22 pm Published by Leave your thoughts
add_action( 'wp_authenticate', 'email_address_login' );

function email_address_login( &$username, &$password )
    $user = get_user_by( 'email', $username );

    if( !empty( $user->user_login ) )
        $username = $user->user_login;

This is really a simple action utilizing the wp_authenticate.


Categorized in:

This post was written by hackya

Leave a Reply

Your email address will not be published. Required fields are marked *