WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

took a look at the questions but I couldn`t find a similar one.

I need to change the custom error messages that are displayed when user tries to login with a wrong username or password.

Like, change this: "ERROR: The password you entered for the username %1$s is incorrect. Lost your password?" to this "Wrong information" (just an example)

I tried to use the "add_filter" but I`m not familiar with it, so, any help will be appreciated! Thanks

share|improve this question
I've found a very specific solution sutanaryan.com/wordpress/… – user20986 Sep 30 '12 at 6:18
up vote 15 down vote accepted

you can do that using login_errors filter hook and here is how:


function login_error_message($error){
    //check if that's the error you are looking for
    $pos = strpos($error, 'incorrect');
    if (is_int($pos)) {
        //its the right error so you can overwrite it
        $error = "Wrong information";
    return $error;


i just tested the code and it works fine just pasted the code in my theme's functions.php file without changing anything with the .po file

enter image description here

share|improve this answer
Just to make everything clear, I should replace 'incorrect' with the error string? By the way, thanks for your answer! – Vitor Argos Aug 5 '11 at 22:07
Just tried this way and it doesnt work, but Im not sure if the wordpress .po file is overwriting the text. Any ideas? – Vitor Argos Aug 5 '11 at 22:10
the text from WordPress.po is served before that filter hook is fired, and no you don't have to change incorrect, its checking if the error message contains that word. – Bainternet Aug 5 '11 at 22:15
I tried to put this to work but I couldn`t. I actually even tried to remove the conditional part, so it should return the text in the $error variable right? But it has no effect. Digging the .po file I saw that the messages I want to overwrite are located in the wp-includes/user.php file like: "<strong>ERROR</strong>: The username field is empty." – Vitor Argos Aug 5 '11 at 22:37
@Vitor you are doing something wrong, there is no need to touch the .po file, i updated my answer. – Bainternet Aug 6 '11 at 0:03

protected by toscho May 14 '15 at 10:35

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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