Customize Log-in Error Message

Video Transcript

One of the nifty tools that WordPress has built into the system is whenever you try to log in and mistakenly enter either a wrong username or a wrong password, the login page tells you which item you messed up.

Unfortunately, this also helps would be hackers. See, this lets them know that they’ve got the correct password but still need to work on getting the right username, or they’ve got the correct username, but they still need to work on cracking that password.

Now on this class, I’m going to show you a couple of ways to change this error message to something less helpful for those hackers.

Now the easiest way is to use that plugin that we installed way back in the earlier classes on installing securely using softaculous. That was the login Iser plug in and then go ahead and correctly log in here and show you what I’m talking about just for reminder sake. And it is this one right here. Well organize your plugin by softaculous. And while this is the easiest, it does not allow you to customize that message. And I’m going to show you that here in just a second. This does however, have the built in security measure of only allowing a certain number of login attempts before it locks them out. And they can all be configured by you.

But the error message this one gives is a messed up either the username or the password, it doesn’t tell them which. And plus it also restricts the number of logon attempts. So again, this is a good one and the easiest. And you probably already have it installed and activated. Anyway, if you followed that earlier class on installing automatically through softaculous. But I’ve deactivated this for this class. So I can show you how to customize that message. You know, in case you enter that kind of thing, I’m going to be including a copy and paste document that allows you to simply copy and paste this code into the functions dot php file of the active theme you have on your site. Or better, since that would require you to do that over and over again, every time that you change themes.

You know, you change things a lot. But better than that is using the plugin code snippets, like what we used in a prior class. And that just requires us to install and activate this plug in here called will code snippets by code snippets Pro, and we touched on this briefly in an earlier class, but I’m going to show it to you again. Of course, you have to log into your admin area of your WordPress site, click on Activate once you had the code snippets plugin installed, and you got the little scissor icon over here in your admin left sidebar, go to add new snippets in the little flyout give it a title. And you can use that same title under the description if you’re going to do that i’m not i’m just going to give it a title so that I know what it is later on. And then I’m going to copy and paste this code into the code box. And right here is the code that you can customize. I mean, you don’t have to customize it. I mean, you can leave it as is. But what’s the fun in that if you’re not going to customize it, just use the login Iser plug in.
Now, of course, I’m playing around here, and you would probably not want to do this. But you know, if you’re in a playful mood, go for it. Otherwise, you might want to put in some additional, more helpful information. Because not everybody that makes a mistake on logging into your site is going to be a would be hacker. But for the sake of this demonstration, I think you’ll get the idea, click on activate. Now then let’s go to our login page by logging out and I’m just going to enter some wrong information. That’s the correct username.

That’s the incorrect password. And there’s our customized login error message. Now remember, any one of these security methods that we cover in these classes are not meant to completely prevent a hacker from breaking into your site. But individually or combining them will make the hackers job more difficult so that they move on to the next site that’s easier for them to break into. And that’s going to bring us to the end of this class on why you should and how to customize the login error messages. Thanks for checking it out and you have a great day.