PHPMatters Help You Better Hosting Your PHP-based Sites
How to Change WordPress Login Error Message

How to Change WordPress Login Error Message

As the most powerful site building platform, WordPress enables users a variety of functions to customize their websites. Since many readers wish to get utmost out of WordPress and create custom login page, we make this guide on how to change login error message and let you into an effective way to hit the mark. Besides, we would like to introduce a method to hide login error message as well.

Login error massage is a prompt shown when you enter wrong login information. By default, the message should be “ERROR: Invalid username. Lost your password?” or “ERROR: The password you entered for the username xxx is incorrect. Lost your password?” as what we’ve shown in the screenshot below. In fact, WordPress allows you to make a change to this message. What you need to do is following this guide.

wordpress login error message

Change WordPress Login Error Message

The notification reminds users to correct the wrong username or wrong password and help them find the right way to enter the dashboard. However, it is also a good tip for hackers to guess your login information. If they fail to dope out the secret for the first time, they would like to try it again and again. This is really a big threat to your website security. Since now, we suggest you to go with a new login error message so as to leave no room for any attacks.

There are two solutions available for you to achieve that goal and both require you to add some codes to the functions.php file. Log into your WordPress dashboard and go to Appearance > Editor. Find out function.php (also called Theme Functions) from the right sidebar and then click it.

change wordpress login error message

Add the following codes to the functions.php file and click Update File. And then, you can check it from frontend.

add_filter('login_errors', create_function('$no_login_error', 'return "The user name and password is incorrect."'));

Here, we set “Oops! Wrong login information” as the login error massage and make the login page look like the following screenshot. Certainly, you are allowed to replace this example to some other words as you want. And also, you can modify the message in anytime.

change wordpress login error message

The second method for the same purpose is shown as below. Likewise, replace the words to your preferred ones and then click Update File to confirm all changes.

function login_error_override()
{
    return 'The user name and password is incorrect.';
}

add_filter('login_errors', 'login_error_override');

Hide WordPress Login Error Message

In addition to the above-mentioned codes used to change login error massage, you can hide the prompt as well. The following codes is help you attain to the goal.

add_filter('login_errors', create_function('$a', 'return null;'));

By now, you may take a tumble how understandable the whole process is! Although there is a need to use codes, you just need to target the functions.php via WordPress dashboard and then copy and paste the mentioned codes to this file. Frankly, the use of plugin is not easier than this method. Remember not to leave out any characters or specific symbols included in the codes, or you cannot succeed.