Created
March 26, 2019 13:37
-
-
Save adriano66/16c90ae62f2a0a482a63c80c5fa2c044 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function login_error_message() | |
| { | |
| global $errors; | |
| $err_codes = $errors->get_error_codes(); | |
| if ( ! empty(array_intersect([ | |
| 'invalid_username', | |
| 'invalid_email', | |
| 'incorrect_password', | |
| 'authentication_failed', | |
| ], $err_codes))) | |
| { | |
| // wp login form hack to prevent clearing username from login form in case user is not existing | |
| $errors->remove('invalid_username'); | |
| $errors->add('incorrect_password', ''); | |
| return __('<strong>ERROR</strong>: Invalid username, email address or incorrect password.') . | |
| ' <a href="' . wp_lostpassword_url() . '">' . | |
| __('Lost your password?') . | |
| '</a>'; | |
| } | |
| else | |
| { | |
| return $errors->get_error_message(); | |
| } | |
| } | |
| add_filter('login_errors', 'login_error_message'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment