SecurityUpdated Feb 2026

    How to Secure Your WordPress Admin Panel From Hackers

    13,000 WordPress sites get hacked every day, and 80% of them had weak admin security. Your /wp-admin panel is the front door to your entire website. This guide shows you how to lock it down with 2FA, login limits, file hardening, and more.

    Mallory Keegan
    Mallory Keegan

    Web hosting enthusiast who tests providers and breaks down features, pricing, and real world speed

    WordPress admin security hardening with shield protection, two-factor authentication, and firewall layers blocking unauthorized access
    WordPress admin security hardening with shield protection, two-factor authentication, and firewall layers blocking unauthorized access.

    🚨 The 5 Most Critical Steps

    1. Enable 2FA: Blocks 99.9% of brute force attacks, even if passwords are compromised.

    2. Limit login attempts: Block IPs after 3-5 failed attempts. Stops automated attacks instantly.

    3. Use strong, unique passwords: 16+ characters via a password manager. Never reuse passwords.

    4. Keep everything updated: 29% of hacks exploit outdated plugins. Enable auto-updates.

    5. Change the default admin username: Delete the "admin" account; it's the first username bots try.

    Why wp-admin Is the #1 Target

    WordPress powers 43% of all websites, making /wp-admin the most targeted login page on the internet. Attackers know the exact URL, the default username ("admin"), and have databases of billions of leaked passwords to try.

    35%

    of WordPress hacks are brute force login attacks

    29%

    exploit vulnerable or outdated plugins

    12%

    target outdated WordPress core versions

    24%

    exploit weak hosting, themes, or file permissions

    Change the Default Login URL

    Every WordPress site uses /wp-login.php and /wp-admin/ by default. Changing this eliminates 90%+ of automated bot attacks that blindly target these URLs.

    Using WPS Hide Login (Recommended)

    1. Install and activate WPS Hide Login (200K+ installs, free)
    2. Go to Settings → WPS Hide Login
    3. Change the login URL to something unique (e.g., /my-secret-login)
    4. Set the redirection URL (where /wp-admin redirects to; use a 404 page)
    5. Bookmark your new login URL: you won't be able to access the old one

    ⚠️ Important: This is security through obscurity, it stops bots but not targeted attacks. Always combine with 2FA and login limiting. If you use a caching plugin, clear the cache after changing the URL.

    Enforce Strong Passwords

    Password TypeLengthCrack TimeVerdict
    password12311 chars< 1 second❌ Instant crack
    MyDog$Name202414 chars~3 hours❌ Dictionary attack
    Tr0ub4dor&311 chars~3 days⚠️ Predictable substitutions
    correct-horse-battery-staple28 chars~550 years✅ Good passphrase
    kX9#mP2$vL7@nQ4&jR820 chars~3 billion years✅ Generated password

    Password Policy Best Practices

    • Use a password manager (1Password, Bitwarden), generate unique 20+ char passwords for every account
    • Require all admin/editor users to use password managers (enforce via policy)
    • Never share passwords via email, Slack, or text; use the password manager's sharing feature
    • Check passwords against breach databases (Have I Been Pwned), compromised passwords are tried first
    • WordPress generates strong passwords by default, don't let users override with weak ones

    Enable Two-Factor Authentication (2FA)

    2FA is the single most effective security measure you can implement. Even if an attacker gets your password, they can't log in without the second factor. Google reports that TOTP-based 2FA blocks 99.9% of automated attacks.

    PluginPriceMethodsBest For
    WP 2FAFree / $29/yrTOTP, Email, Backup codesBest overall, clean UI, role-based enforcement
    Two-Factor (core team)FreeTOTP, Email, FIDO U2FLightweight, built by WordPress contributors
    Wordfence Login SecurityFreeTOTP, reCAPTCHAIf already using Wordfence firewall
    miniOrange 2FAFree / $59/yrTOTP, SMS, Push, Security QMost 2FA methods, enterprise features

    Recommendation: Use TOTP (time-based one-time passwords) with an app like Google Authenticator, Authy, or 1Password. Avoid SMS-based 2FA; it's vulnerable to SIM swapping attacks. Always generate and securely store backup codes in case you lose your authenticator device.

    Limit Login Attempts

    By default, WordPress allows unlimited login attempts, an attacker can try millions of passwords without being blocked. Login limiting is essential.

    Recommended Settings

    • Lock out after 3-5 failed attempts
    • First lockout: 20 minutes
    • Subsequent lockouts: 24 hours
    • Permanent block after 3 lockouts
    • Whitelist your own IP address
    • Log all failed login attempts

    Best Plugins

    • Limit Login Attempts Reloaded (2M+ installs, free)
    • Wordfence (includes brute force protection)
    • Login LockDown (lightweight, simple)
    • Cloudflare WAF (blocks at CDN level, best performance)

    Pro tip: Combine with Cloudflare's free plan for the most effective protection. Cloudflare's Bot Fight Mode and WAF rules block most brute force traffic before it even reaches your server, reducing server load and eliminating 95%+ of login attacks.

    Lock Down User Roles & Permissions

    RoleCan DoCannot DoAssign To
    AdministratorEverything, full controlN/A (unrestricted)Only site owner (1-2 people max)
    EditorManage all content, moderate commentsInstall plugins, change themes, manage usersContent managers, senior writers
    AuthorWrite & publish own postsEdit others' posts, manage settingsRegular blog writers
    ContributorWrite drafts (cannot publish)Publish, upload media, edit othersGuest writers, freelancers
    SubscriberView content, manage own profileCreate or edit any contentRegistered users, commenters

    Principle of Least Privilege

    • Give each user the minimum role needed for their job, never make everyone an Administrator
    • Audit user accounts quarterly; remove inactive accounts and downgrade unnecessary admin access
    • Use the User Role Editor plugin to create custom roles if default WordPress roles don't fit
    • Require 2FA for all Administrator and Editor accounts (enforced, not optional)
    • Set an auto-logout timeout (15-30 minutes) for admin sessions

    Harden File Permissions

    File/DirectoryRecommendedNever UseWhy
    All directories755777Owner can write; others can only read/traverse
    All files644666 or 777Owner can write; others can only read
    wp-config.php600 or 640644+Contains database credentials; most sensitive file
    .htaccess644777Controls server behavior, critical for security rules
    wp-content/uploads/755777Must be writable for media uploads but not world-writable

    Fix Permissions via SSH

    # Set directory permissions to 755
    find /path/to/wordpress/ -type d -exec chmod 755 {} \;
    
    # Set file permissions to 644
    find /path/to/wordpress/ -type f -exec chmod 644 {} \;
    
    # Lock down wp-config.php
    chmod 600 /path/to/wordpress/wp-config.php
    
    # Lock down .htaccess
    chmod 644 /path/to/wordpress/.htaccess

    wp-config.php Security Tweaks

    Add these lines to your wp-config.php file for significant security improvements:

    // Disable file editing from wp-admin (prevents code injection via admin panel)
    define('DISALLOW_FILE_EDIT', true);
    
    // Disable plugin/theme installation from admin (require SFTP)
    define('DISALLOW_FILE_MODS', true);
    
    // Force SSL for admin panel
    define('FORCE_SSL_ADMIN', true);
    
    // Limit post revisions (reduces database bloat)
    define('WP_POST_REVISIONS', 5);
    
    // Set auto-save interval (seconds)
    define('AUTOSAVE_INTERVAL', 300);
    
    // Disable WordPress debug mode in production
    define('WP_DEBUG', false);
    define('WP_DEBUG_LOG', false);
    define('WP_DEBUG_DISPLAY', false);
    
    // Block external HTTP requests (whitelist specific hosts if needed)
    // define('WP_HTTP_BLOCK_EXTERNAL', true);
    // define('WP_ACCESSIBLE_HOSTS', 'api.wordpress.org,downloads.wordpress.org');
    
    // Move wp-content directory (optional, advanced)
    // define('WP_CONTENT_DIR', dirname(__FILE__) . '/app');
    // define('WP_CONTENT_URL', 'https://example.com/app');

    Disable Unnecessary Features

    Disable: XML-RPC

    Risk: Enables brute force amplification (hundreds of password attempts in one request) and DDoS via pingbacks.

    Add to .htaccess:
    <Files xmlrpc.php>
      Require all denied
    </Files>

    Disable: REST API User Enumeration

    Risk: Exposes usernames via /wp-json/wp/v2/users, attackers use these for targeted brute force.

    Add to functions.php:
    add_filter('rest_endpoints', function($endpoints) {
      unset($endpoints['/wp/v2/users']);
      return $endpoints;
    });

    Disable: WordPress Version Number

    Risk: Tells attackers your exact WordPress version, helping them target known vulnerabilities.

    Add to functions.php:
    remove_action('wp_head', 'wp_generator');

    Disable: File Editor (Appearance → Editor)

    Risk: Allows anyone with admin access to inject PHP code directly into theme/plugin files.

    Add to wp-config.php:
    define('DISALLOW_FILE_EDIT', true);

    Best Security Plugins Compared

    PluginPriceFirewallMalware Scan2FABest For
    WordfenceFree / $119/yr✅ App-level✅✅Best free option, comprehensive protection
    Sucuri$199/yr✅ Cloud WAF✅❌Best cloud firewall, blocks before reaching server
    Solid Security (iThemes)Free / $99/yr✅ Basic✅ (Pro)✅Lightweight, low server impact
    All-In-One WP SecurityFree✅ Basic⚠️ Limited✅Beginners, visual security grading system
    MalCare$99/yr✅ Cloud✅ Cloud-based❌Cloud-based scanning (no server impact)

    Activity Monitoring & Alerts

    You can't protect what you can't see. Activity logging records every admin action (login attempts, plugin changes, user modifications, and content edits ) so you can detect compromises early.

    What to Monitor

    • Failed login attempts (threshold: 3+ per IP)
    • Successful logins from new IPs or locations
    • User role changes (especially to Administrator)
    • Plugin/theme installations and updates
    • File modifications in core WordPress files
    • Database changes to options table

    Activity Log Plugins

    • WP Activity Log

      Most comprehensive logging, tracks 500+ events, real-time alerts, user session management

    • Simple History

      Lightweight, free, logs logins, content changes, plugin updates in a simple timeline

    • Stream

      Developer-friendly logging with filtering, export, and integrations (Slack, email)

    WordPress Admin Security Checklist

    Two-factor authentication enabled for all admin/editor accountsCritical
    Login attempts limited (3-5 attempts before lockout)Critical
    Strong, unique passwords enforced (16+ characters, password manager)Critical
    Default 'admin' username deleted and replacedCritical
    WordPress core, plugins, and themes auto-updatedCritical
    File editing disabled via DISALLOW_FILE_EDIT in wp-config.phpHigh
    wp-config.php permissions set to 600 or 640High
    SSL/HTTPS forced for admin panel (FORCE_SSL_ADMIN)High
    XML-RPC disabled (unless specifically needed)High
    Login URL changed from default /wp-adminMedium
    REST API user enumeration disabledMedium
    WordPress version number hidden from source codeMedium
    Activity monitoring plugin installed and alerts configuredMedium
    Security plugin with WAF installed (Wordfence or Sucuri)High
    User roles follow principle of least privilegeMedium
    Inactive user accounts removed quarterlyLow

    Frequently Asked Questions

    Is it safe to use 'admin' as a WordPress username?
    No. 'admin' is the first username bots try in brute force attacks. If your admin account uses 'admin' as the username, create a new administrator account with a unique username, transfer ownership of all content, then delete the old 'admin' account. Usernames cannot be changed in WordPress; you must create a new account. Also avoid predictable names like your domain name, 'administrator', or 'webmaster'.
    Does changing the wp-admin URL actually improve security?
    It reduces automated bot attacks by 90%+ because bots target /wp-login.php and /wp-admin/ by default. However, it's security through obscurity, not a replacement for strong passwords and 2FA. A determined attacker can still find your login page. Think of it as the first layer of defense: it eliminates noise so you can focus on real threats. Use it alongside (not instead of) 2FA and login limiting.
    Which WordPress security plugin is best?
    For most sites: Wordfence (free), best firewall + malware scanner combo with the largest threat intelligence network. For premium: Sucuri, includes a cloud WAF that stops attacks before they reach your server. For lightweight: iThemes Security (Solid Security), less resource-intensive, good for shared hosting. For managed hosts: many already include server-level firewalls (Kinsta, Cloudways), so a lightweight plugin for login protection is sufficient.
    How often are WordPress sites hacked?
    Approximately 13,000 WordPress sites are hacked per day (4.7 million per year). 80% of hacks exploit weak passwords or outdated plugins/themes, not WordPress core vulnerabilities. The most common attack vectors: brute force login (35%), vulnerable plugins (29%), outdated core (12%), vulnerable themes (8%), and hosting-level compromises (16%). Keeping everything updated and using 2FA prevents the vast majority of attacks.
    Should I disable XML-RPC?
    Yes, unless you specifically need it. XML-RPC allows remote access to WordPress and is exploited for: (1) Brute force amplification, attackers can try hundreds of passwords in a single request. (2) DDoS attacks via pingback abuse. (3) SSRF (Server Side Request Forgery) attacks. Disable it completely if you don't use the WordPress mobile app, Jetpack, or remote publishing tools. Add to .htaccess: <Files xmlrpc.php> Require all denied </Files>
    What file permissions should WordPress use?
    Directories: 755 (owner read/write/execute, group and others read/execute). Files: 644 (owner read/write, group and others read-only). wp-config.php: 600 or 640 (owner read/write only, the most sensitive file). .htaccess: 644. Never use 777 (world-writable) on any file or directory; this gives any user on the server full access. If a plugin requires 777, find a different plugin.

    Need Hosting with Built-In WordPress Security?

    Managed WordPress hosts include server-level firewalls, malware scanning, and automatic updates, so you can focus on your content instead of security.

    Find Secure Hosting