· 7 min read · Mert Tati
How to Stop WordPress Brute Force Attacks: A Guide to Login Limits
How to stop WordPress brute force attacks and limit login attempts: thresholds, long lockouts, XML-RPC multicall, 2FA and the real IP behind Cloudflare.
Short answer: To stop WordPress brute force attacks, count failed logins within a time window, lock out the IP once a threshold is crossed, apply long lockouts to repeat offenders and get an alert the moment a lockout happens. But counting only on the login page is not enough: attempts made through XML-RPC multicall, 2FA codes and application passwords must go into the same counter, and behind Cloudflare you have to read the correct IP.

What is a brute force attack and what does it look like in WordPress?
A brute force attack automatically tries huge numbers of username and password combinations until it finds the right one. On WordPress, it is usually done with leaked password lists. The signs are familiar: server load goes up, log files balloon, your hosting company sends a warning, and if you have a security plugin it lists attempts against usernames such as admin, administrator or your site name.
WordPress core neither logs nor limits failed logins. So with no protection in place, a bot can try unlimited passwords against the same account. The first step is to limit login attempts.
How to limit WordPress login attempts: threshold, window, lockout
A login limit is made up of three settings, and the balance between them matters:
- Threshold: how many failed attempts trigger a lockout. Too low and it locks out real users who mistype their password; too high and it gives attackers plenty of guesses.
- Window: the time period in which attempts are counted, for example 8 attempts in 5 minutes; once the window expires, the counter resets.
- Lockout duration: how long an IP that crosses the threshold has to wait. A short lockout (say, 15 minutes) does little harm to real users but slows bots down considerably.
- Long lockout: if the same IP gets locked out several times within 24 hours, the lockout should stretch to hours. Bots simply wait out short lockouts and carry on; a long lockout breaks that cycle.
- Reset on successful login: resetting the counter for an IP that logs in correctly protects the office user who mistypes their password once or twice.
Count per IP or per IP + username?

Counting per IP is the strictest method: every failed attempt from the same IP adds to one counter. It stops attackers from earning extra guesses by switching usernames. The downside is that in an office sharing one IP, one person's mistakes can lock everyone out.
With per IP + username counting, each username gets its own counter. Teams on a shared IP don't lock each other out, but a bot can cycle through different usernames to make more attempts in total. As a rule of thumb, per-IP counting makes more sense for sites where individual admins log in, while IP + username combined with an allowlist suits sites where many users log in from the same network.
Why do attempts continue even with a hidden login URL? XML-RPC multicall
Hiding or limiting the login page does not close the attacker's only door. xmlrpc.php is a separate, fully privileged entry point; with the system.multicall method, hundreds of passwords can be tried in a single HTTP request. A login limit tuned for the login page may count that request as a single attempt. We saw this firsthand on a client's store: attempts continued even though the login URL was hidden, and the source turned out to be XML-RPC. If you don't use Jetpack or the old mobile app, disable XML-RPC login, or at least reject multicall. Detailed steps are in our guide to changing the login URL.
2FA and application password failures must count too
2FA stops a login even if the password is compromised, but if the second step can be tried without limit, a 6-digit code can in theory be guessed. That's why the 2FA screen should limit code attempts per session, and failed 2FA attempts should also go into the main lockout counter. The same applies to application passwords that authenticate through the REST API: if failed attempts through that route aren't counted, a second, unlimited door is left open for attackers.
Allowlisted IPs, manual blocking and alert emails
- IP allowlist: your office's or server's static IP should never be locked out. This removes the risk of locking yourself out, but keep the list short.
- Manual IP blocking: when you see an IP persistently trying in the logs, you should be able to block it for a long period without waiting for the threshold.
- Alert emails: an email to one or more addresses at the moment of lockout shows you right away that an attack has started. If the site has no working SMTP, these emails never arrive, so first make sure outgoing mail works.
- Activity log: seeing which IP, which username and which source (login page, XML-RPC, REST) an attempt came from tells you which door to close.
Counting the right IP behind Cloudflare
If your site sits behind Cloudflare or another proxy, the server sees the IP of the proxy, not the visitor. If your login limit counts that address, different visitors are treated as one person and innocent users get locked out together. The fix is to read the real IP from Cloudflare's CF-Connecting-IP header, but that header should only be trusted when the request actually comes from Cloudflare's network. Otherwise an attacker can hit the server directly with a spoofed header, appear as a different IP on every attempt and bypass the limit entirely.
Distributed attacks: when per-IP limits aren't enough
Large botnets stay under per-IP limits by making only a few attempts from each IP. In that case, the real defense comes from layers working together: a hidden login URL cuts most of the traffic, 2FA makes stolen passwords useless, and closing username leaks leaves the attacker guessing at targets. A truly heavy flood should be stopped at the Cloudflare or hosting level before it reaches the server; rules such as country-based restrictions are defined there too.
Checklist
- Login limits are on, with threshold, window and lockout duration configured.
- Repeat offender IPs get long lockouts.
- The counting method suits your site (per IP or per IP + username).
- XML-RPC login and system.multicall are disabled.
- 2FA and application password failures go into the lockout counter.
- Your own static IP is allowlisted, and lockout alerts go out through a working SMTP.
- Behind Cloudflare, the verified real IP is counted.
Doing it with Hushfort
The Limit Login & Alerts and Surface Hardening modules of the Hushfort WordPress security plugin cover this whole list together. The default is a 15-minute lockout after 8 failed attempts in 5 minutes; if the same IP is locked out 4 times in 24 hours, a 24-hour long lockout applies. All of these can be changed. Counting is per IP or per IP + username, and the counter can optionally reset on a successful login. 2FA and application password failures go into the same counter, and the Surface Hardening module disables XML-RPC login and rejects multicall.
Allowlisted IPs are never blocked. From the History tab you can manually block an IP (for the long lockout duration, 24 hours by default) or lift a block with one click; the same screen shows the usernames tried and the source of each attempt. Lockout alerts can go to multiple comma-separated addresses; if the site has no SMTP, the alert switch stays off and tells you why. When Cloudflare is selected as the IP source, the header is only trusted for requests coming from Cloudflare's network. For installation and configuration help, contact our Izmir-based team through our software and maintenance service. We covered what to look for when choosing a plugin in our post on the best WordPress security plugin.
Frequently asked questions
What should I do if I lock myself out? Wait for the lockout to expire, or have another admin lift the block from the History screen. If you have a static IP, adding it to the allowlist from the start removes this risk.
Will login limits affect WooCommerce customers? Not if the threshold is reasonable. A customer who mistypes their password a few times waits briefly, and the counter resets on a successful login.
Can a brute force attack crash my site? A heavy attack can slow your site down because every attempt runs PHP and database queries. Hiding the login URL, disabling XML-RPC and locking out IPs that cross the threshold greatly reduce that load.
Do I need login limits if I have a strong password? Yes. A strong password lowers the odds of success, but it doesn't remove the load the attempts create or the risk from leaked passwords. Login limits and 2FA should be used together.
Summary: limit login attempts with a threshold, a window and long lockouts; count XML-RPC multicall, 2FA and application password failures too. Read the correct IP, allowlist your own IP, make sure alerts actually arrive, and stop large floods at the Cloudflare or hosting level.