← Back to Blog

WordPress Login Page Security: The Complete Guide

Secure your WordPress login page with custom URLs, CAPTCHA, login attempt limits, IP whitelisting, and two-factor authentication using VistoShield Login Guard.

WordPress Login Page Security: The Complete Guide

Introduction: Your Login Page Is Under Constant Attack

The WordPress login page (wp-login.php) is the most attacked endpoint on any WordPress site. Every minute of every day, automated botnets probe WordPress login pages around the world, attempting to guess credentials through brute-force attacks, credential stuffing from leaked databases, and password spraying. This is not theoretical — if you install a logging plugin on any public WordPress site, you will see hundreds or thousands of failed login attempts within the first 24 hours.

The default WordPress login page has essentially no protection against these attacks. There is no rate limiting, no account lockout after failed attempts, no CAPTCHA, no two-factor authentication, and the URL (/wp-login.php or /wp-admin/) is universally known. An attacker does not even need to discover where the login page is — they already know.

This guide covers every significant technique for securing the WordPress login page, from quick wins like custom login URLs to comprehensive protections like two-factor authentication and IP whitelisting. We show how VistoShield Login Guard implements these protections with progressive lockouts, honeypot fields, built-in 2FA, and more. For additional detail on brute-force protection specifically, see our dedicated brute-force protection guide.

Understanding Login Page Attack Types

Before implementing defenses, it helps to understand exactly what you are defending against. Login page attacks fall into several categories, each with different characteristics and effective countermeasures.

Brute-Force Attacks

The attacker tries a large number of password combinations against a known username. Modern brute-force tools can attempt thousands of passwords per minute against an unprotected WordPress login. The attack is simple and automated:

# Example: Using WPScan for brute-force (for authorized testing only)
wpscan --url https://target.com --passwords passwords.txt --usernames admin

# Or using Hydra
hydra -l admin -P passwords.txt target.com http-post-form \
    "/wp-login.php:log=^USER^&pwd=^PASS^:incorrect"

Effective countermeasures: login attempt limits, progressive lockouts, 2FA, strong passwords.

Credential Stuffing

The attacker uses username/password pairs leaked from other breached services. Since many people reuse passwords, a credential that works on a breached social media site may also work on the victim’s WordPress site. Credential stuffing is more targeted than brute-force and has a higher success rate.

Effective countermeasures: 2FA (the primary defense), unique passwords, breach monitoring.

Password Spraying

The attacker tries a small number of very common passwords (e.g., "password123", "admin2026") against many different usernames. This avoids triggering per-user lockouts while still testing the most likely credentials.

Effective countermeasures: IP-based rate limiting (not just per-user), honeypot fields, strong password enforcement.

XML-RPC Amplification

WordPress’s xmlrpc.php endpoint supports a system.multicall method that allows testing hundreds of passwords in a single HTTP request. This bypasses per-request rate limiting and can be much faster than attacking wp-login.php directly.

# Example: Testing multiple passwords in one XML-RPC request
curl -X POST https://target.com/xmlrpc.php -d '
<methodCall>
  <methodName>system.multicall</methodName>
  <params>
    <param><value><array><data>
      <value><struct>
        <member><name>methodName</name><value>wp.getUsersBlogs</value></member>
        <member><name>params</name><value><array><data>
          <value>admin</value><value>password1</value>
        </data></array></value></member>
      </struct></value>
      <!-- Repeat for hundreds of passwords -->
    </data></array></value></param>
  </params>
</methodCall>'

Effective countermeasures: Disable XML-RPC or block system.multicall. The VistoShield Firewall handles this automatically.

Defense 1: Login Attempt Limits and Progressive Lockouts

The most fundamental login security measure is limiting the number of failed login attempts before imposing a lockout. Without this, attackers can try unlimited passwords at maximum speed.

How VistoShield Progressive Lockouts Work

VistoShield Login Guard implements progressive lockouts that escalate with repeated failures. This is more effective than a simple fixed lockout because it penalizes persistent attackers while being forgiving of legitimate users who mistype their password once or twice.

Failed AttemptsLockout DurationDescription
3 failures1 minuteQuick lockout for typos — minimal impact on real users
6 failures5 minutesLikely an attack, not a typo
9 failures15 minutesSustained attack — significant slowdown
12 failures1 hourAggressive attack — long block
15+ failures24 hoursPersistent attacker — effectively blocked for the day

Lockouts are applied per IP address, so a lockout on one attacker’s IP does not affect legitimate users on other IPs. The lockout counters reset after a successful login or after the lockout period expires.

Configuration Options

Login Guard’s lockout settings are configurable via VistoShield > Login Guard > Brute Force Protection in the WordPress admin:

  • Max attempts before first lockout — Default: 3. How many failures before the first lockout.
  • Lockout escalation multiplier — Default: 3x. Each subsequent lockout is 3 times longer.
  • Maximum lockout duration — Default: 24 hours. The ceiling for lockout escalation.
  • Lockout scope — Per IP (default) or per username. Per-IP is recommended to avoid denial-of-service against specific accounts.
  • Whitelist IPs — Your own IP addresses that should never be locked out. Important for preventing self-lockout.

Defense 2: Custom Login URL

Changing the WordPress login URL from the default /wp-login.php to a custom path significantly reduces the volume of automated attacks. Most brute-force bots target only the default URL and do not attempt to discover custom login pages.

Important Caveat

A custom login URL is a defense-in-depth measure, not a primary security control. It reduces noise (fewer attack attempts) but does not provide real security against a targeted attacker. Think of it as moving your front door — it stops casual intruders but not someone who is determined to find it. Always combine it with stronger measures like lockouts and 2FA.

Implementing a Custom Login URL with Login Guard

VistoShield Login Guard includes a custom login URL feature. Navigate to VistoShield > Login Guard > Custom Login URL and set your preferred path:

  • Choose something non-obvious but memorable: /my-portal, /team-access, /site-login
  • Avoid security-related terms that are easily guessable: /secret-login, /hidden-admin, /secure-login
  • When enabled, requests to /wp-login.php and /wp-admin/ (for non-logged-in users) return a 404 Not Found response

Manual Implementation (Without a Plugin)

If you prefer to implement a custom login URL without a plugin, you can use .htaccess rewrite rules:

# .htaccess custom login URL
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Block direct access to wp-login.php (unless from custom URL)
    RewriteCond %{REQUEST_URI} ^/wp-login\.php
    RewriteCond %{QUERY_STRING} !^custom-login-key=your-secret-key
    RewriteRule .* - [R=404,L]

    # Redirect custom URL to wp-login.php with key
    RewriteRule ^my-portal/?$ /wp-login.php?custom-login-key=your-secret-key [L,QSA]
</IfModule>

Defense 3: Honeypot Fields

Honeypot fields are invisible form fields added to the login form. Real users (using browsers) never see or fill them in. Automated bots, which programmatically fill in all form fields, populate the honeypot field and immediately reveal themselves as bots. This technique is simple, has zero impact on user experience, and catches a significant percentage of automated attacks.

How VistoShield Honeypots Work

VistoShield Login Guard adds a hidden field to the login form with a realistic-looking name (e.g., email_address, website, or phone). The field is hidden via CSS so human users never see it. When a submission includes a value in the honeypot field, Login Guard immediately rejects it as a bot submission and logs the event.

Honeypots are effective against:

  • Simple brute-force bots that fill all form fields
  • Credential stuffing tools that do not parse the form
  • Automated scanners that submit form data programmatically

They are less effective against sophisticated targeted attacks that render JavaScript and analyze the page like a real browser. For those, you need stronger measures like 2FA.

DIY Honeypot Implementation

// Add a honeypot field to the login form
add_action('login_form', function () {
    echo '<p style="position:absolute;left:-9999px;top:-9999px;">';
    echo '<label for="website_url">Website</label>';
    echo '<input type="text" name="website_url" id="website_url" value="" autocomplete="off" tabindex="-1">';
    echo '</p>';
});

// Check the honeypot field on authentication
add_filter('authenticate', function ($user, $username, $password) {
    if (!empty($_POST['website_url'])) {
        // Honeypot was filled in - this is a bot
        do_action('wp_login_failed', $username);
        return new WP_Error('bot_detected', 'Authentication failed.');
    }
    return $user;
}, 1, 3);

Defense 4: CAPTCHA and Challenge-Response

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) systems present a challenge that is easy for humans but difficult for bots. They are effective at blocking automated attacks but add friction to the login experience.

Types of CAPTCHA

TypeUser ExperienceBot ResistancePrivacy
Google reCAPTCHA v2 (checkbox)ModerateHighLow (Google tracking)
Google reCAPTCHA v3 (invisible)Excellent (invisible)HighLow (Google tracking)
hCaptchaModerateHighGood (privacy-focused)
Cloudflare TurnstileExcellent (invisible)HighGood
Math CAPTCHAGoodLowExcellent (no third party)
Honeypot (VistoShield)Excellent (invisible)Medium-HighExcellent (no third party)

Recommendation

For most WordPress sites, we recommend the following layered approach:

  1. Honeypot fields (via Login Guard) as the primary invisible challenge — catches most bots with zero friction
  2. Cloudflare Turnstile or hCaptcha as a secondary visible challenge for high-security sites
  3. Avoid Google reCAPTCHA if GDPR compliance is a concern due to data transfer to Google

Defense 5: Two-Factor Authentication (2FA)

Two-factor authentication is the single most effective defense against login page attacks. Even if an attacker obtains valid credentials through brute-force, credential stuffing, phishing, or any other method, they cannot log in without the second factor.

VistoShield Login Guard includes built-in TOTP-based 2FA and email-based 2FA. For a comprehensive guide on implementing 2FA, including setup instructions, backup codes, and enforcement strategies, see our dedicated Two-Factor Authentication guide.

Key 2FA Recommendations for Login Security

  • Enforce 2FA for all administrator and editor accounts — These are the highest-value targets.
  • Use TOTP as the primary method — It is more secure than email-based 2FA.
  • Generate and store backup codes — Prevent lockouts from lost devices.
  • Use the "Remember Device" feature — Reduces friction on trusted devices while maintaining security on unknown ones.

Defense 6: IP Whitelisting for Admin Access

If your administrators access the site from known, static IP addresses, IP whitelisting is an extremely effective defense. Only the specified IPs can even see the login page; all other IPs receive a 403 Forbidden response.

Using .htaccess for IP Whitelisting

# Restrict wp-login.php to specific IPs
<Files wp-login.php>
    Order Deny,Allow
    Deny from all
    # Office IP
    Allow from 203.0.113.50
    # Home IP
    Allow from 198.51.100.25
    # VPN IP range
    Allow from 192.0.2.0/24
</Files>

Using Nginx for IP Whitelisting

# Nginx: Restrict login page to specific IPs
location = /wp-login.php {
    allow 203.0.113.50;   # Office
    allow 198.51.100.25;  # Home
    allow 192.0.2.0/24;   # VPN
    deny all;

    include fastcgi_params;
    fastcgi_pass php-fpm;
}

Limitations of IP Whitelisting

  • Dynamic IPs — Most residential ISPs assign dynamic IP addresses that change periodically. Whitelisting becomes a maintenance burden.
  • Remote work — Team members working from various locations (coffee shops, hotels, co-working spaces) have unpredictable IPs.
  • VPN as a solution — Using a VPN with a static exit IP gives you a consistent IP to whitelist, regardless of physical location.

VistoShield Login Guard IP Controls

Login Guard provides IP-based access controls through the WordPress admin interface, eliminating the need to edit server configuration files. You can whitelist IPs, blacklist IPs, and restrict login access to specific geographic regions (GeoIP blocking).

Defense 7: Hiding wp-admin

By default, accessing /wp-admin/ while not logged in redirects to wp-login.php. This makes it trivially easy for attackers to find the login page. Hiding wp-admin means that unauthenticated requests to /wp-admin/ return a 404 Not Found instead of redirecting to the login page.

// Return 404 for unauthenticated wp-admin access
add_action('init', function () {
    if (is_admin() && !is_user_logged_in() &&
        !defined('DOING_AJAX') && !defined('DOING_CRON') &&
        (strpos($_SERVER['REQUEST_URI'], '/wp-admin') !== false) &&
        (strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin-ajax.php') === false)) {
        status_header(404);
        nocache_headers();
        include(get_query_template('404'));
        exit;
    }
});

Login Guard handles this automatically when the custom login URL feature is enabled.

Defense 8: Disable XML-RPC

As discussed earlier, xmlrpc.php is a major attack vector for login brute-force. If you do not use XML-RPC (the Jetpack plugin and the WordPress mobile app are the main consumers), disable it entirely:

Disable via Filter

// Disable XML-RPC entirely
add_filter('xmlrpc_enabled', '__return_false');

// Also remove the XML-RPC discovery link from the head
remove_action('wp_head', 'rsd_link');

Disable via .htaccess

# Block all access to xmlrpc.php
<Files xmlrpc.php>
    Order Deny,Allow
    Deny from all
</Files>

VistoShield Firewall XML-RPC Controls

The VistoShield Firewall provides granular XML-RPC controls: disable it entirely, block only system.multicall (the method used for brute-force amplification), or restrict XML-RPC to specific IP addresses. This allows sites that need XML-RPC (e.g., for Jetpack) to keep it functional while blocking abuse.

Defense 9: Login Page Security Headers

Security headers on the login page can prevent certain types of attacks:

# Add security headers for wp-login.php
<Files wp-login.php>
    Header set X-Frame-Options "DENY"
    Header set X-Content-Type-Options "nosniff"
    Header set X-XSS-Protection "1; mode=block"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
    Header set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"
</Files>
  • X-Frame-Options: DENY — Prevents the login page from being embedded in an iframe (clickjacking defense)
  • X-Content-Type-Options: nosniff — Prevents MIME type sniffing
  • Content-Security-Policy — Restricts the resources the login page can load, preventing injected scripts

Defense 10: Monitoring and Alerting

No defense is complete without monitoring. You need to know when attacks are happening, whether your defenses are working, and when something unusual occurs.

What to Monitor

  • Failed login attempts — A sudden spike indicates an active attack
  • Successful logins from new IPs or countries — May indicate a compromised account
  • Lockout events — High lockout rates mean your defenses are active and attacks are ongoing
  • 2FA bypass attempts — Someone trying to bypass 2FA is likely not a legitimate user
  • Login page traffic volume — Unusual traffic patterns to the login page

VistoShield Activity Log Integration

The VistoShield Activity Log records all authentication events with full context: IP address, user agent, timestamp, username attempted, success/failure reason, 2FA status, and lockout events. You can configure email alerts for specific events (e.g., successful admin login from a new IP) to get real-time notification of potential security issues.

For full details on activity logging, see our Activity Log guide.

Login Security Implementation Checklist

Use this checklist to verify your login page security. Items marked with a check are handled by VistoShield Login Guard.

  • Login attempt limits active — Progressive lockouts configured and tested
  • Two-factor authentication enforced — Required for all admin and editor accounts
  • Backup codes generated — All 2FA users have stored backup codes
  • Custom login URL set — Default wp-login.php returns 404 for unauthenticated users
  • Honeypot fields active — Invisible bot-catching fields on the login form
  • XML-RPC disabled or restrictedsystem.multicall blocked at minimum
  • wp-admin hidden — Unauthenticated /wp-admin/ requests return 404
  • Strong password policy enforced — Minimum length, complexity requirements
  • Security headers configured — X-Frame-Options, CSP on login page
  • Login activity monitored — Failed attempts, successful logins, lockouts logged
  • Email alerts configured — Notifications for admin logins from new IPs
  • User enumeration blocked — REST API and author archives restricted (see our REST API security guide)

Getting Started with VistoShield

Securing the WordPress login page is one of the highest-impact security improvements you can make, and VistoShield Login Guard makes it straightforward. It combines progressive lockouts, honeypot fields, custom login URL, IP whitelisting, and built-in two-factor authentication in a single plugin. Combined with the rest of the VistoShield security suite, it provides comprehensive protection:

  • Login Guard — Progressive lockouts, honeypot fields, 2FA (TOTP and email), custom login URL, IP whitelisting, and login activity monitoring.
  • Firewall & WAF — XML-RPC controls, rate limiting, REST API user enumeration blocking, and application-layer request filtering.
  • Security Scanner — Vulnerability scanning, malware detection, file integrity monitoring, and file permission auditing.
  • Bot Detector — Identifies and blocks automated brute-force bots, credential stuffing tools, and login page scanners.
  • Activity Log — Complete audit trail for all authentication events, lockouts, 2FA events, and security incidents.

All five plugins are available in the free tier under the GPLv2 open-source license. For advanced features, the Single Pro plan starts at €19/site/year, the Pro Bundle is €49/site/year, and the Agency Bundle covers 25 sites for €149/year. Visit the VistoShield homepage to get started, or explore the Login Guard documentation for detailed setup instructions.

Ready to try VistoShield?

Free and open source. Get started in 60 seconds.

Get Started Free