Enter your keyword

Blog

Allow Email Login Username or Email Admin and Frontend

add_filter('authenticate', 'dsweb_allow_email_login', 20, 3);
function dsweb_allow_email_login( $user, $username, $password ) {
    if ( is_email( $username ) ) {
        $user = get_user_by_email( $username );
        if ( $user ) $username = $user->user_login;
    }
    return wp_authenticate_username_password( null, $username, $password );
}

No Comments

Add your review

Your email address will not be published.

* Feilds are Required.