Added woocommerce phone login, get error message
-
I added the following code to theme>function.php.
When I login with my phone, I don’t get redirected to the verification code page.
Error message appears:The TFA code you entered was incorrect.
add_filter('authenticate', 'loginWithPhoneNumber', 20, 3); function loginWithPhoneNumber($user, $username, $password) { // Try logging in via their billing phone number if (is_numeric($username)) { $matchingUsers = get_users(array( 'meta_key' => 'billing_phone', 'meta_value' => $username, 'meta_compare' => 'LIKE' )); if (is_array($matchingUsers) && !empty($matchingUsers)) { $username = $matchingUsers[0]->user_login; } } return wp_authenticate_username_password(null, $username, $password); }
- The topic ‘Added woocommerce phone login, get error message’ is closed to new replies.