If you want to change login error messages in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.
1 2 3 4 5 6 7 |
add_action( 'wp_login_failed', 'my_login_fail' ); // hook failed login function my_login_fail( $username ) { //redirect to custom login page and append login error flag wp_redirect(home_url( '?page_id=4' ) . "&login_error" ); exit; } |
Obviously you should modify wp_redirect
depending on permalinks you are using.
Then in your custom page template you can check the login_error flag and display error message:
1 2 3 |
if (isset($_GET['login_error'])){ //print error message or do something else } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.