Home/Blog/WordPress
WordPress · Security · Login

How to Limit Login Attempts in WordPress

Naveen Goyal
24 November 2026
3 min read
WordPress
Short answer

WordPress lets anyone try passwords forever. Limit failed attempts per IP (for example 5 tries, then a 20-minute lockout), allow-list your own IP, make sure the real visitor IP is read behind Cloudflare, block XML-RPC if you do not use it, and add two-factor authentication for administrators.

Why WordPress needs a login limit

Out of the box, wp-login.php accepts unlimited guesses. Bots run through leaked password lists against thousands of sites at once. Even when they fail, every attempt costs your server a PHP request and a database lookup, and one weak password is enough.

Lockout settings that work

SettingGood starting pointWhy
Failed attempts before lockout5Enough for a real person who mistypes
First lockout20 minutesStops bots without punishing people
Repeat offendersBlock the IP for 24 hours or moreBots come back; people rarely do
Email alertsOn, for repeated failuresYou see an attack while it happens

Tighten the numbers if your logs show a steady attack; loosen them if real users get locked out.

Don't lock yourself out

  • Allow-list your own IP and your developer's before you switch limits on.
  • Behind Cloudflare or a load balancer, the plugin must read the real visitor IP from headers such as CF-Connecting-IP. If it reads the proxy's IP, every visitor looks like the same address and one bot locks everyone out.
  • Keep FTP or File Manager access handy. Renaming the security plugin's folder disables it if you ever need to get back in.

Close the back door: XML-RPC

xmlrpc.php also accepts usernames and passwords, and one request can try many passwords at once. If you do not use the WordPress mobile app, Jetpack or a tool that needs XML-RPC, turn off its authenticated methods with this filter in a small plugin or your child theme:
add_filter( 'xmlrpc_enabled', '__return_false' );

What else to switch on

  • Two-factor authentication for every administrator. A stolen password alone is then useless. See two-factor authentication for WordPress.
  • Unique, long passwords and no account named admin.
  • A login log, so you can see who tried, from where, and when.

Set it up in 5 minutes with Login Guard

  1. Install NaveenCodes Login Guard from WordPress.org and activate it.
  2. Add your IP to the Allow List under IP Manager.
  3. Set the failed-attempt threshold and lockout time.
  4. Turn on email alerts.
  5. Ask each administrator to set up 2FA from their profile, then require it for administrators.

Everything runs on your own server: IPs and usernames stay in your database, and nothing is sent to a cloud service.

Frequently asked questions

Does WordPress limit login attempts by default?

No. WordPress allows unlimited login attempts, so you need a plugin or a server rule to limit them.

How many login attempts should I allow?

Five failed attempts followed by a 20-minute lockout is a good start, with longer blocks for IPs that keep coming back.

Will limiting login attempts lock me out?

Not if you allow-list your own IP first and the plugin reads the real visitor IP behind proxies such as Cloudflare.

Is changing the login URL enough?

It hides the page from simple bots but is not real protection. Use attempt limits and two-factor authentication.

Free tool: Login Guard

Attempt limits, live login log, IP block and allow lists, email alerts and 2FA. Free, runs on your server.