Sign-in
Login Guard
Moves your sign-in page to an address only you know, so the robots that try passwords on every WordPress site cannot find it.
What it does
Every WordPress site signs in at the same address: your site name followed by /wp-login.php. Login Guard gives your sign-in page a new address that you choose, such as yoursite.com/team-door.
The part you choose is called the slug. A slug is simply the last part of a web address.
Once it is on, anyone who is not signed in and tries /wp-login.php or /wp-admin gets nothing useful. You decide what they see instead.
Why you might want it
Most attacks on WordPress are not people. They are robots that visit thousands of sites a day and guess passwords at the usual sign-in address.
If the robots cannot find your sign-in page, they cannot guess. Your site does less work, and your activity log stays quiet enough to spot anything real.
It works best together with strong passwords and two-factor sign-in. A hidden door is good; a hidden door with a good lock is better.
Turn it on
- Go to Stack Guard, then the Login tab, and find Login address.
- Switch on Custom Login URL.
- In Login Slug, type the new address. Use lowercase letters, numbers and hyphens, for example
team-door. Pick something that is not easy to guess, so avoidloginoradmin. - Under Blocked access, choose what people see if they try the old address. The safest choice is Show 404 Not Found Page, your normal "page not found" screen.
- Click Save Changes.
- Copy your new sign-in address from the top of the Login tab and bookmark it now, before you sign out.
Your choices for blocked visitors
Show 404 Not Found Page: the visitor sees your theme's "page not found" screen, as if the sign-in page never existed. This gives robots the least to work with.
Redirect to Homepage: the visitor is quietly sent to your home page.
Redirect to WordPress Page: the visitor is sent to a page you pick in Page, for example an "Access denied" page you wrote. It keeps working if your site moves to a new domain.
Redirect to Custom URL: the visitor is sent to any web address you type in Redirect URL. Remember to update it if your domain changes.
Optional: add an access token
An access token is a secret word added to the end of your sign-in address, like yoursite.com/team-door/?access=k4f9-2mzq-8wht-p3xa. Without it, even someone who knows your slug gets the blocked response.
It only works while Custom Login URL is on.
- In Login address, switch on Login Access Token.
- Click Generate to make a random token, or type your own. Capital letters count, so
Keyandkeyare different. - Choose a Token Mode. Remember Device (Cookie) asks for the token once, then remembers that browser for the number of days in Remember For. Require Every Browser Session asks again each time the browser is closed and opened.
- Click Save Changes, then bookmark the full address including the token.
Optional: catch robots with a honeypot
Switch on Login Honeypot to add an invisible box to your sign-in form. People never see it, so they leave it empty. Robots fill in every box they find, which gives them away.
A robot caught this way is told the username or password is wrong, so it learns nothing. You will see it in the activity log as "Blocked - Honeypot".
What you and your visitors will notice
Your sign-out, lost password and registration links update themselves to the new address. Password reset emails use it too.
Shortcuts like yoursite.com/login and yoursite.com/admin no longer lead to the sign-in page.
When you are already signed in, opening your sign-in address shows a "page not found" screen. That is normal: go to /wp-admin instead, which works as usual while you are signed in.
If you use password-protected posts, their page code contains your sign-in address, because WordPress sends the post password through it. Add an access token if that matters to you.
Some other plugins expect the usual sign-in address. If a membership or login plugin stops working, check its settings for a login address and use your new one.
If you forget the address or get locked out
First, look for your bookmark. Anyone who is signed in with full Stack Guard access can also see the address at the top of the Login tab.
If nobody can sign in, you can switch Login Guard off from a file on your server called wp-config.php. It is a settings file in the main folder of your site. You can open it with your web host's file manager or an FTP program. If you are not sure how, your web host's support team can do this for you.
- Open
wp-config.phpand find the line that saysThat's all, stop editing! - Just above that line, add:
define( 'SMG_DISABLE_LOGIN_GUARD', true );and save the file. - Sign in at the usual address,
yoursite.com/wp-login.php. A red notice at the top of the dashboard reminds you that recovery mode is on. - Go to the Login tab and note your sign-in address, or change it.
- Remove the line you added from
wp-config.php, so Login Guard protects the site again.
If two-factor sign-in gets stuck during recovery
If the second sign-in step does not load while recovery mode is on, also add define( 'SMG_DISABLE_2FA', true ); on the next line, and remove it again afterwards.
For a bigger emergency, define( 'SMG_SAFE_MODE', true ); switches off every protection that could keep you out: Login Guard, two-factor, lockouts, bans, country blocking, firewall rules, CAPTCHA and IP reputation checks. Remove it as soon as you are back in.
Which plan includes it
Login Guard, the access token and the honeypot are included in every plan, including Free. They keep working if a paid plan ends, so changing plans can never lock you out.
How it works, for developers
- The custom address is served on
initat priority 9999. Requests towp-login.phpand/wp-adminfrom visitors who are not signed in get the blocked response you chose. - Links WordPress builds to the sign-in page are rewritten through the
site_url,wp_redirect,logout_urlandlostpassword_urlfilters, so emails and menus use the new address. - Access token:
Remember Devicemode sets a cookie for the number of days chosen (default 30);Require Every Browser Sessionuses a cookie that ends when the browser closes. The token is compared in constant time. - Honeypot: a hidden field is added on
login_formand checked on theauthenticatefilter at priority 1, before any password check. - Settings:
smg_custom_login_enabled,smg_login_slug,smg_block_behavior,smg_block_page_id,smg_custom_redirect,smg_login_token_enabled,smg_login_token,smg_login_token_mode,smg_login_token_cookie_days,smg_login_honeypot_enabled. The slug and token are never included in settings exports.
Quick answers about login guard
What does Login Guard do in Stack Guard?
Every WordPress site signs in at the same address: your site name followed by /wp-login.php. Login Guard gives your sign-in page a new address that you choose, such as yoursite.com/team-door. The part you choose is called the slug. A slug is simply the last part of a web address. Once it is on, anyone who is not signed in and tries /wp-login.php or /wp-admin gets nothing useful. You decide what they see instead.
Why use login guard on a WordPress site?
Most attacks on WordPress are not people. They are robots that visit thousands of sites a day and guess passwords at the usual sign-in address. If the robots cannot find your sign-in page, they cannot guess. Your site does less work, and your activity log stays quiet enough to spot anything real. It works best together with strong passwords and two-factor sign-in. A hidden door is good; a hidden door with a good lock is better.
How do I set up login guard?
1. Go to Stack Guard, then the Login tab, and find Login address. 2. Switch on Custom Login URL. 3. In Login Slug, type the new address. Use lowercase letters, numbers and hyphens, for example team-door. Pick something that is not easy to guess, so avoid login or admin. 4. Under Blocked access, choose what people see if they try the old address. The safest choice is Show 404 Not Found Page, your normal "page not found" screen. 5. Click Save Changes. 6. Copy your new sign-in address from the top of the Login tab and bookmark it now, before you sign out.
Which Stack Guard plan includes login guard?
Login Guard, the access token and the honeypot are included in every plan, including Free. They keep working if a paid plan ends, so changing plans can never lock you out.
More in Sign-in
- Sign-in errors and sessionsStops the sign-in page from telling strangers which usernames exist, signs out sessions left idle, and caps how long "Remember me" keeps someone signed in.
- Two-factor authenticationAdds a second step to signing in: after the password, a code from a phone app or an email. A stolen password alone is no longer enough to get in.
- Brute Force ProtectionStops password guessing by locking out anyone who gets the password wrong too many times in a row.
- Magic links for locked-out usersLets a real user who has been locked out ask for a one-time sign-in link by email, instead of waiting for the lockout to end or calling you.
- CAPTCHAAdds a quick "are you human?" check to your sign-in, sign-up, password reset and comment forms, so robots cannot use them.
Not running Stack Guard yet? It is free.
Download Free