Skip to content
Daleel Web

WordPress

How to protect your WordPress login from brute force attacks

Bots try passwords on your WordPress login all day. Learn the defenses that matter: strong passwords, 2FA, rate limiting, CAPTCHA and XML-RPC.

By Daleel Web Editorial TeamPublished 2 min read
A login form protected by a shield

A brute force attack is the simplest way to break in: software repeatedly tries username and password combinations until one works. These attempts are automated and often spread across many machines, so even failed attacks can overwhelm a site with requests (WordPress documentation). Every site with a login page can be targeted, and WordPress's popularity makes it a common focus.

1. Strong, unique passwords

Use long, unique passwords or passphrases and a password manager. Avoid dictionary words and personal information. Do not use the username admin: create a separate admin account and demote or remove old users. Keep the number of administrators small and use lower-privilege roles for daily work.

2. Two-factor authentication

Passwords are relatively easy to break, and a server breach can leak them. Two-step authentication adds a second proof, usually a code from your phone (WordPress documentation). WordPress core does not include it, so enable it for every administrator through a reputable plugin or your identity provider. The documentation also mentions passkeys, which give phishing-resistant, passwordless login through a maintained plugin; enroll at least two authenticators per admin.

3. Limit login attempts

The best place to rate-limit is at the edge (a WAF or CDN) or your web server, so bad traffic is blocked before it reaches WordPress. If your host does not offer that, a security plugin can throttle attempts, but it still runs inside PHP and uses resources during a heavy attack. A CAPTCHA or Cloudflare Turnstile on the login form also slows bots.

4. Handle XML-RPC

xmlrpc.php is a frequent brute-force target. If you do not use it, disable it. If you do, for example for Jetpack or mobile apps, restrict it and rate-limit it aggressively.

5. Things the documentation advises against

  • Relying only on a hidden login URL.
  • Permanent country blocklists.
  • Password-protecting the whole /wp-admin directory, which can break AJAX-based plugins.

If you add server-level blocks, scope them narrowly, for example to /wp-login.php and /xmlrpc.php, and test on a staging copy first.

6. Keep the basics in place

Use HTTPS so credentials are protected in transit (see what SSL/HTTPS is), keep WordPress, themes and plugins updated, watch failed-login logs and keep tested backups (backup guide).

Checklist

  • No admin username; few administrators
  • Long, unique passwords in a password manager
  • 2FA on every administrator account
  • Rate limiting at the host, CDN or server
  • XML-RPC disabled or restricted
  • HTTPS on, everything updated, backups tested

Frequently asked questions

Does WordPress include two-factor authentication?

Not in core. The WordPress documentation says it must be added through a plugin or your identity provider (SSO).

Is hiding the login URL enough?

No. The documentation says obscuring the login URL can reduce noise but should not be your only defense.

Should I disable XML-RPC?

If you do not use it, yes. The documentation says xmlrpc.php is a frequent brute-force target. If you need it, for example for Jetpack or mobile apps, restrict and rate-limit it.

Should I block whole countries?

The documentation advises against permanent country blocklists, because they can block legitimate users and are hard to maintain.

Sources & references

  1. WordPress Developer Resources: Brute Force Attacks
  2. WordPress Developer Resources: Two Step Authentication