Leave a Reply

1 comment

  1. As of WordPress 4.5, logging in with the email address instead of username has been added to core functionality. It was introduced in ticket 9568.

    If you are running a version of WordPress older than 4.5, the following small small plugin will work. If you don’t (or can’t) use a plugin, this should – in theory – as well work from within your functions.php file. Just leave the plugin comment header out.

    <?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' );
    

    Hope this helps.