First of all get user by Phone no.
$user = reset(
get_users(
array(
'meta_key' => 'PHONE_META_KEY_HERE',
'meta_value' => $USER_PHONE_NO_HERE,
'number' => 1,
'count_total' => false
)
)
);
Now check if Password matches with the user we retrived by phone.
if($user){
if(wp_check_password($USER_PASSWORD_HERE, $user->user_pass, $user->ID)){
// Success. User login credentials matched. Login user with `wp_set_auth_cookie`.
wp_clear_auth_cookie();
wp_set_current_user ( $user->ID );
wp_set_auth_cookie ( $user->ID );
$redirect_to = user_admin_url();
wp_safe_redirect( $redirect_to );
exit();
} else {
// Throw Error. Password Does not Match.
}
} else {
// Throw Error. User not found with phone no.
}
For More info about wp_set_auth_cookie
Click here.