For security reasons, my WordPress instance should give the same error message when an incorrect password or wrong username is used. How can it be done?


You can use login_errors filter for changing the custom error message

Please have a look at

Change login error messages


I tried the solution suggested in the accepted answer myself. But it works only if the 'password' input is wrong. The snippet below will echo "Wrong credentials" regardless of wrong password or username. Just sharing something I learned from here. Hope this saves someone a little time.

add_filter( 'login_errors', 'rs_custom_login_error' );
function rs_custom_login_error(){
    return $error = "Wrong credentials.";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.