For the login, I want to enable the user to use the email instead of the username. This is what I got so far:
remove_filter('authenticate', 'wp_authenticate_username_password', 20);
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');
The result of this, is the following error message:
"Invalid username or password. Please try again!"
functions.php
file but then what is the problem? What is your question? Are you getting any error? Explain your issue.remove_filter('authenticate', 'wp_authenticate_username_password', 20); 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');