May 282012
WordPress Plugin Name: Limit Login Attempts
Plugin URL:

Plugin Author: Johan Eenfeldt
WordPress profile: Johan Eenfeldt
Plugin version: 1.7.1
Last updated: June 1, 2012 (7 years ago)
Tested up to (WP version): WP 3.3.2
Downloaded: 0
Rating: 5 (out of 5)


Limit the number of login attempts possible both through normal login as well as using auth cookies.

By default WordPress allows unlimited login attempts either through the login page or by sending special cookies. This allows passwords (or hashes) to be brute-force cracked with relative ease.

Limit Login Attempts blocks an Internet address from making further attempts after a specified limit on retries is reached, making a brute-force attack difficult or impossible.


  • Limit the number of retry attempts when logging in (for each IP). Fully customizable
  • Limit the number of attempts to log in using auth cookies in same way
  • Informs user about remaining retries or lockout time on login page
  • Optional logging, optional email notification
  • Handles server behind reverse proxy
  • It is possible to whitelist IPs using a filter. But you probably shouldn’t. 🙂

Translations: Bulgarian, Brazilian Portuguese, Catalan, Chinese (Traditional), Czech, Dutch, Finnish, French, German, Hungarian, Norwegian, Persian, Romanian, Russian, Spanish, Swedish, Turkish

Plugin uses standard actions and filters only.


Installation Instructions

  1. Download and extract plugin files to a wp-content/plugin directory.
  2. Activate the plugin through the WordPress admin interface.
  3. Customize the settings on the options page, if desired. If your server is located behind a reverse proxy make sure to change this setting.

If you have any questions or problems please make a post here:

Why not reset failed attempts on a successful login?

This is very much by design. Otherwise you could brute force the “admin” password by logging in as your own user every 4th attempt.

What is this option about site connection and reverse proxy?

A reverse proxy is a server in between the site and the Internet (perhaps handling caching or load-balancing). This makes getting the correct client IP to block slightly more complicated.

The option default to NOT being behind a proxy — which should be by far the common case.

How do I know if my site is behind a reverse proxy?

You probably are not or you would know. We show a pretty good guess on the option page. Set the option using this unless you are sure you know better.

Can I whitelist my IP so I don’t get locked out?

First please consider if you really need this. Generally speaking it is not a good idea to have exceptions to your security policies.

That said, there is now a filter which allows you to do it: “limit_login_whitelist_ip”.

function my_ip_whitelist($allow, $ip) {
return ($ip == ‘my-ip’) ? true : $allow;
add_filter(‘limit_login_whitelist_ip’, ‘my_ip_whitelist’, 10, 2);

Note that we still do notification and logging as usual. This is meant to allow you to be aware of any suspicious activity from whitelisted IPs.

I locked myself out testing this thing, what do I do?

Either wait, or:

If you know how to edit / add to PHP files you can use the IP whitelist functionality described above. You should then use the “Restore Lockouts” button on the plugin settings page and remove the whitelist function again.

If you have ftp / ssh access to the site rename the file “wp-content/plugins/limit-login-attempts/limit-login-attempts.php” to deactivate the plugin.

If you have access to the database (for example through phpMyAdmin) you can clear the limit_login_lockouts option in the wordpress options table. In a default setup this would work: “UPDATE wp_options SET option_value = ” WHERE option_name = ‘limit_login_lockouts'”


  1. Loginscreen after failed login with retries remaining

    Loginscreen after failed login with retries remaining

  2. Loginscreen during lockout

    Loginscreen during lockout

  3. Administration interface in WordPress 3.0.4

    Administration interface in WordPress 3.0.4

Other notes:

Latest Change log entry:

This version fixes a security bug in version 1.6.2 and 1.7.0. Please upgrade immediately.

“Auth cookies” are special cookies set at login that authenticating you to the system. It is how WordPress “remembers” that you are logged in between page loads.

During lockout these are supposed to be cleared, but a change in 1.6.2 broke this. It allowed an attacker to keep trying to break these cookies during a lockout.

Lockout of normal password login attempts still worked as it should, and it appears that all “auth cookie” attempts would keep getting logged.

In theory the “auth cookie” is quite resistant to brute force attack. It contains a cryptographic hash of the user password, and the difficulty to break it is not based on the password strength but instead on the cryptographic operations used and the length of the hash value. In theory it should take many many years to break this hash. As theory and practice does not always agree it is still a good idea to have working lockouts of any such attempts.


authentication, login, security

+ Jason's Comments

If spam is a problem in comments try this combination:
Require login to comment (in WP discussion settings), allow Social connect (through a registered profile) and this plugin to limit login attempts.