Where and how would I be able to customize the login error messages?
"Error: The username <> is not registered on this site. If you are unsure of your username, try your email address instead."
and "Error: The password you entered for the username <> is incorrect. Lost your password?"
I've tried using this code, but nothing. Any help would be appreciated!
global $errors;
$err_codes = $errors->get_error_codes();
// Invalid username.
if ( in_array( 'invalid_username', $err_codes ) ) {
$error = '<strong>ERROR</strong>: This email address is not registered. Please check or contact XXX for more information.';
}
// Incorrect password.
if ( in_array( 'incorrect_password', $err_codes ) ) {
$error = '<strong>ERROR</strong>: The password you provided is incorrect. Please try again or contact XXX for more information. ';
}
return $error;
}
add_filter( 'login_errors', 'my_custom_error_messages');```