Every WordPress site has its login page at the same address, /wp-login.php, so bots try it all day long. You secure it in layers: limit how many guesses an address can make, add a second factor, slow bots down with a challenge, close the XML-RPC side door, and serve the page only over HTTPS. Moving the login address cuts the noise, but it isn't a defence on its own.

Why is wp-login.php such a common target?

Because the address never changes, a bot doesn't need to know anything about your site to attack it. It requests /wp-login.php on millions of sites and submits common usernames with leaked or guessed passwords. Each attempt also costs your server real work: WordPress loads, queries the users table and checks a deliberately slow password hash. A steady stream of attempts can slow the whole site down even when no password is ever guessed.

Step 1: limit login attempts

Rate limiting counts failed logins per IP address, and often per username too. After a few failures in a short window, further attempts are refused for a while. Guessing then becomes far too slow to work.

Things to get right:

  1. Count failures per address and per username. Botnets spread guesses over many addresses, so a per-username limit catches attacks a per-IP limit misses.
  2. Lock out for a period, not forever. Ten or fifteen minutes is enough to stop automation without locking real users out for good.
  3. Read the real visitor address. Behind a CDN or proxy, every request appears to come from the proxy's address unless your setup passes the visitor's IP through correctly. Otherwise one lockout blocks everyone.
  4. Use a well-tested plugin or your host's tools rather than writing your own. WordPress core has no lockout built in, and home-made versions often get the proxy and IP details wrong.

Step 2: add two-factor authentication

Two-factor authentication asks for a second proof after the password, usually a six-digit code from an authenticator app. A guessed, phished or leaked password is then not enough to get in.

  • Turn it on for every administrator and editor first, then for anyone else who can publish or manage orders.
  • Store backup codes somewhere safe, so a lost phone doesn't lock you out.
  • WordPress core has no two-factor feature, so this comes from a plugin. Choose one that is actively maintained and widely used.

Step 3: add a challenge for bots

A CAPTCHA or a similar challenge on the login form stops simple scripts that submit the form directly. It must be checked on the server when the form is submitted; a widget that only appears in the browser stops nothing. Expect some friction for real users, and check that the challenge you pick works with keyboards and screen readers.

Step 4: consider moving the login address

Moving the login page to a custom address removes most automated noise from your logs, because bots aim at the default path. Do it with a maintained plugin or a security plugin's setting. Hand-made rewrites often break password resets, logouts and redirects, because wp-login.php links to itself in many places.

Remember the limits: the new address can leak through a link, a theme or a plugin, and it does nothing against a weak password. Treat it as noise reduction on top of the steps above.

Step 5: close or limit xmlrpc.php

xmlrpc.php is an older remote-publishing interface. One request to it can carry many login attempts, which makes it popular with brute-force tools. If nothing you use needs it (some mobile apps, older integrations and a few plugins do), block it at the server. On Apache:

<Files xmlrpc.php>
    Require all denied
</Files>

Test afterwards: if a service you rely on stops publishing or syncing, it needed XML-RPC, and you should limit the file rather than block it.

Step 6: serve the login page only over HTTPS

On plain HTTP, a username and password cross the network as readable text. Make sure both addresses in Settings › General start with https://, redirect all HTTP traffic to HTTPS at the server, and add this line to wp-config.php so the dashboard and login always use HTTPS:

define( 'FORCE_SSL_ADMIN', true );

Step 7: watch the failed logins

After hardening, keep an eye on failed logins. A sudden rise, a burst of attempts against one real username, or a successful login from a country you never log in from is worth investigating. Many security plugins log these for you; WordPress itself keeps no login log.

Common mistakes

  • Relying on a hidden login address alone. Once the address is found, nothing else stands in the way.
  • Lockouts that ignore the proxy. Behind a CDN, a per-IP lockout can block every visitor at once.
  • Two-factor for some administrators only. Attackers look for the one account without it.
  • Blocking xmlrpc.php without testing. Some apps and integrations stop working quietly.
  • Keeping an account called admin. It is the first username every bot tries; WordPress can't rename it, so create a new administrator and delete the old account.

What these defences can't do

Lockouts and challenges slow automated guessing; they don't stop a password that was phished or reused from another site, which is what two-factor authentication is for. Two-factor doesn't help if an attacker already has code running on your site through a vulnerable plugin. And none of these steps replace strong, unique passwords and prompt updates. For how the layers fit together, see our guide to layered WordPress brute force protection.

How Silent Threads helps

Silent Threads includes brute-force lockout and two-factor on the free plan, and adds a custom login URL plus login CAPTCHA on paid plans.

The short version

Limit failed logins per address and per username, turn on two-factor authentication for every powerful account, add a server-checked challenge, close xmlrpc.php if you don't need it, force HTTPS for the dashboard, and watch for unusual failed logins. Moving the login address is a useful extra, not a substitute.