Hide Your WordPress Login Page From Bots and Attacks
Move your WordPress login from wp-login.php to a secret slug and send logged-out visitors to a 404: bots scanning the standard address find no form there.
Every WordPress site on earth has its login at the same address: wp-login.php. Every brute-force bot knows it, every vulnerability scanner tries it first, and there’s nothing in stock WordPress to change that—the URL is hardcoded. So your login page gets hammered around the clock by scripts that will never stop, because they always know exactly where to knock. The most effective response isn’t a bigger lock. It’s moving the door.
The essentials
- Every WordPress login lives at
wp-login.php—a universal target every bot already knows. - The module moves login to a secret slug and sends the old URL and
/wp-admin(for logged-out visitors) to your 404 page or another page of your site, with a 302 redirect. - It skips AJAX, REST API, XML-RPC, cron and CLI, so plugins, apps and scheduled tasks keep working—which also means
xmlrpc.phpstill accepts sign-in attempts: hiding the login shrinks the target, it doesn’t remove it. - Reserved slugs (
wp-admin,wp-login,xmlrpc.php…) are refused, and the login slug is kept out of the plugin’s own page cache—so you can’t accidentally break or expose it. - It’s off until you enable it, warns you to bookmark the URL, and recommends pairing with Fatal Error Recovery as a lockout safety net.
Why is wp-login.php such a problem?
wp-login.php is a problem because WordPress gives you no built-in way to change the login URL, block direct access to it, keep logged-out visitors out of /wp-admin, or send those attempts elsewhere. So the login page sits there, identical and predictable, on millions of sites—and every bot already knows the address.
The result is relentless automated traffic. Bots don’t need to succeed to cost you: they burn server resources, bury your logs under failed attempts, and can noticeably slow a small site just by knocking thousands of times a day. Rate limiting and CAPTCHAs fight that traffic once it arrives. Hiding the login removes the address that traffic aims at, so most of it never finds a form—if a bot can’t find the door, it can’t hammer it.
How do you hide your WordPress login page?
Activate the Hide Login Page module in Blaminhor Essentials, then set two things: a secret login slug that replaces wp-login.php, and where to send everyone else—your 404 page or another page of your site. Logged-in users still reach the admin normally, and AJAX, REST, cron, CLI and XML-RPC stay untouched, so nothing on your site breaks.
The login form itself doesn’t change; only its address does.
Set a secret login URL
Replace wp-login.php with a slug you choose, so your login becomes yoursite.com/my-secret-door/ instead of the address every bot tries. Make it memorable but not guessable—avoid obvious choices like admin, login or signin (the field starts at login, so change it). The module actively blocks reserved slugs (wp-admin, wp-login, xmlrpc.php and the like) so you can’t pick something that would collide with WordPress itself.
Send everyone else away
Once enabled, anyone reaching wp-login.php or /wp-admin without being logged in gets a 302 redirect—by default to /404, a path that doesn’t exist on your site, so your theme shows its not-found page; or to another page of your site, given by its slug (leave the field empty for the homepage). They never see a login form, and never learn one exists at that slug. Logged-in users reach the admin normally, and AJAX, REST API, XML-RPC, cron and CLI requests are untouched, so nothing on your site breaks. The flip side: xmlrpc.php keeps accepting sign-in attempts, so a bot that posts credentials there instead of to the login form isn’t stopped by this module (see below). The custom login slug is also kept out of the plugin’s own page cache; with another cache plugin or a CDN, exclude it there yourself.
Here’s what changes for each kind of request, so you can see nothing legitimate gets caught:
| Request | Default WordPress | With Hide Login Page |
|---|---|---|
wp-login.php in a browser (logged out) | Login form shown to anyone | 302 redirect to /404 (your theme’s not-found page) or to the page you pick |
/wp-admin (logged out) | Bounces to wp-login.php | Same redirect—no login revealed |
| Your secret slug | Doesn’t exist | Shows the login form |
| AJAX | Works | Untouched—deliberately skipped |
| REST API | Works | Untouched—deliberately skipped |
| XML-RPC | Works | Untouched—still accepts sign-in attempts |
| Cron / WP-CLI | Work | Untouched—deliberately skipped |
What about locking yourself out?
Locking yourself out is the one genuine risk of hiding a login: forget the custom URL and you’re on the outside too. The Hide Login Page module builds in two safeguards—a reminder to bookmark the slug before you enable it, and a recommendation to activate Fatal Error Recovery first, whose secret URL can switch the plugin off and restore wp-login.php.
- Bookmark the URL. The module shows a clear reminder before you enable it—save the slug somewhere you trust.
- Enable Fatal Error Recovery first. This companion module provides a secret recovery URL from which you can switch Blaminhor Essentials off, which brings
wp-login.phpback if you lose your custom login address. Hide Login explicitly recommends turning it on before you activate—two modules from the same plugin that know about each other.
What does a hidden login look like in practice?
On a client site, hiding the login takes five settings: activate Hide Login Page, choose a slug such as client-access, leave the redirect on 404, enable Fatal Error Recovery and store its recovery URL, then switch the protection on. From then on, only yoursite.com/client-access/ shows a login form to a logged-out visitor.
Say you manage a client site and want the login invisible to bots and to the client alike:
- Activate Hide Login Page.
- Set the login slug to something like
client-access. - Set the redirect to
404. - Enable Fatal Error Recovery and save its recovery URL somewhere safe.
- Turn the protection on.
Now yoursite.com/wp-login.php and yoursite.com/wp-admin/ both send a logged-out visitor to the 404 page. The only way in through a browser is yoursite.com/client-access/. Bots scanning for wp-login.php get a redirect instead of a form, and the failed-login noise in your logs drops—except what still arrives through xmlrpc.php, which this module leaves open. That door belongs to Login Security: its throttle counts XML-RPC attempts too, and its Refuse XML-RPC sign-in entirely switch closes it—off by default, because the WordPress and Jetpack mobile apps sign in that way.
Why is hiding the login worth five minutes?
Moving your login doesn’t touch your passwords or your 2FA—it removes the address the automated scans depend on. No .htaccess edits, no server config: just a different URL, and a much quieter site. Pair it with the HTTPS Redirect, Fatal Error Recovery and Login Security modules and your login surface is about as small as WordPress lets it get.
Hide Login Page is one of the 26 modules in Blaminhor Essentials—free and open-source on WordPress.org.
– blaminhor
FAQ
Does hiding the login page actually stop brute-force attacks?
It stops the automated scans aimed at wp-login.php: once login lives at a secret slug, bots get a redirect to your 404 page. Two limits: xmlrpc.php, the remote-publishing endpoint, stays open to sign-in attempts, and a human who finds your slug still needs your password. The Login Security module covers both, with throttling, an optional XML-RPC block and two-factor sign-in.
Will hiding my login break AJAX, the REST API or cron?
No. The module deliberately skips AJAX, REST API, XML-RPC, cron and CLI requests, so plugins, apps and scheduled tasks keep working normally. Only browser requests to the old login page, wp-register.php and wp-admin by logged-out visitors are redirected away.
How do I change the wp-admin URL too?
You don't rename /wp-admin—it stays, but the module sends any logged-out visitor who hits it straight to your 404 page (a 302 redirect) or to another page of your site you choose, so nobody without a session ever sees a login. Once your login slug is secret, /wp-admin becomes a dead end for bots; logged-in users still reach it normally.
Is hiding the login better than limiting login attempts or 2FA?
It's complementary, not a replacement. Rate limiting and 2FA fight attacks once they reach your login; hiding the page means most never arrive, cutting the noise those tools have to handle. The strongest setup layers all three—a hidden slug, limited attempts and 2FA—rather than trusting any single one. Since version 2.6.0, Blaminhor Essentials ships the other two layers in its Login Security module.
What if I forget my custom login URL and get locked out?
That's the one real risk, so bookmark the URL and pair the module with Fatal Error Recovery, a companion module that gives you a secret recovery link from which you can switch Blaminhor Essentials off, which brings wp-login.php back (with WP-CLI, `wp blaminhor hide-login disable` does the same for this module only). Hide Login even reminds you to enable it first. Reserved slugs like wp-admin, wp-login or xmlrpc.php are refused so you can't break WordPress itself; note that the default slug is `login`, so change it, since bots try that one too.
Will hiding my login interfere with page caching?
No. The module excludes your custom login slug from the plugin's own page cache, so that cache can't store the login page or serve a stale version of it. With another cache plugin or a CDN, exclude the slug there too. Everything else caches as normal—only the sensitive login route is deliberately kept out.
Comments