Skip to content
    Guide

    Harden WordPress: hardening settings, firewall and two-factor sign-in

    Last updated

    Hardening means changing settings so a site is harder to break into: closing doors attackers commonly use, hiding information that helps them and making logins tougher. None of it replaces keeping software up to date, but together these settings stop a large share of everyday attacks.

    MaintainHQ sets these on your WordPress sites remotely through the MaintainHQ plugin, so you do not have to edit files by hand. This guide covers the WP Hardening tab, the firewall, two-factor sign-in and the emergency reset for administrators who are locked out.

    The WP Hardening tab

    Open Security in the left-hand menu and choose WP Hardening, then pick a site under Select a site to harden. (On a site’s own page, open Security and the site is already chosen.) MaintainHQ reads the site’s current settings; press Refresh to read them again.

    At the top, a score shows how many hardening controls are on, as a percentage: Excellent, Moderate or Needs Work. Apply Recommended turns on the recommended settings that are not already on, in one go, and reports how many it applied. If the site’s plugin does not support a setting yet, it says so.

    If the site has an SSL certificate, a card shows when it expires and how many days are left.

    Login & Access

    Login & Access settings
    SettingWhat it does
    Custom Admin Login URLMoves the login page to an address you choose, such as /my-secret-login. When active, /wp-admin and /wp-login.php return a “not found” page. Press Save to apply
    Block /wp-admin & /wp-login.phpReturns “not found” for the default admin addresses when a custom login address is set, so nobody can bypass it
    Limit Login AttemptsAfter this many failed tries (the default is 5), the visitor is locked out for this many minutes (the default is 30). Press the save icon to apply
    Force Strong PasswordsRequires every user to set a strong password
    Disable XML-RPCTurns off XML-RPC, an old remote access feature often used in password-guessing and flooding attacks

    File & System Protection, API and headers

    Further hardening settings
    SettingWhat it does
    Disable File EditorRemoves the theme and plugin code editor from wp-admin, so a stolen admin login cannot be used to edit code
    Hide WP VersionRemoves the WordPress version number from the page source and feeds
    Disable Directory BrowsingStops visitors seeing a list of the files in a folder
    Disable PHP in UploadsStops PHP files in the uploads folder from running, a common way to plant a backdoor (hidden access for an attacker)
    Restrict REST APIOnly logged-in users can use the WordPress REST API, a way for programs to read and change the site
    X-Frame-OptionsStops other sites showing yours inside a frame, which prevents clickjacking
    HSTS (Strict Transport Security)Tells browsers to always use the secure HTTPS address
    X-Content-Type-OptionsStops browsers guessing file types, which blocks some attacks
    Core, Plugin and Theme Auto-UpdatesLets WordPress install updates for core, all plugins or all themes by itself

    Disable Directory Browsing and Disable PHP in Uploads work through a server file called .htaccess. On servers that ignore it (nginx), the switch is unavailable and MaintainHQ shows the line your host needs to add instead.

    The firewall

    The firewall checks requests to your site and blocks common attacks before WordPress handles them. Turn it on per site in the Firewall card on the Overview tab of the Security page, or on a site’s Firewall tab.

    With it on, the MaintainHQ plugin (3.7.0 or later) blocks SQL injection, cross-site scripting (XSS) and path traversal attempts, and probes for sensitive files such as wp-config.php. It also locks an IP address out of logging in for 15 minutes after 20 failed logins. Administrators are never blocked.

    Blocked requests appear after the site’s next hourly check-in. The firewall cards show Blocked, Allowed, Unique IPs and the Top Rule, and Recent Firewall Activity lists individual requests.

    Two-factor sign-in for WordPress users

    Two-factor sign-in means WordPress logins ask for a code from an authenticator app on the user’s phone as well as the password, so a stolen password is not enough. The check happens on the site itself, so sign-in keeps working even if MaintainHQ is unreachable. It needs the MaintainHQ plugin 3.23.0 or later. You find the Two-factor sign-in card on the WP Hardening tab.

    Two-factor settings
    SettingChoices
    Two-factor sign-inOff; Optional: users choose; Required for chosen roles
    Time to set it upStraight away, or 3, 7, 14 or 30 days (when required)
    Remember a deviceNever: ask every time, or for 7 or 30 days
    Required forThe roles that must use it, such as Administrator and Editor

    Press Save. Each user then sets it up on their own WordPress profile page. Until their time runs out they see a reminder; after that they can only reach their profile page until they set it up. The table shows each user’s status and warns when someone has fewer than 3 backup codes left.

    If someone loses their phone, press Reset next to them. Their app and backup codes stop working and they sign in with just their password until they set it up again. Only do this once you are sure it is really them asking.

    Emergency reset for a locked-out administrator

    On a site’s Security tab, the Emergency reset card helps an administrator who cannot get into wp-admin. It needs two-factor authentication on your own MaintainHQ account (set it up under Profile).

    1. Press Start emergency reset.
    2. Choose the administrator who is locked out and press Continue.
    3. Enter the current code from your authenticator app (or a backup code) and press Reset and make link.
    4. Copy the single-use sign-in link and give it only to that person.

    MaintainHQ signs them out everywhere, and opening the link replaces their password so they choose a new one straight away. The link works once and expires; it is not shown again. The account owner is emailed every time.

    Frequently asked questions

    Will Apply Recommended break my site?
    It is designed to be safe for most sites, but Restrict REST API and Disable XML-RPC can affect apps or services that connect to the site without logging in. Check the site afterwards and turn off any setting that causes a problem.
    I set a custom login address and forgot it. What now?
    Open the WP Hardening tab for the site: the Custom Admin Login URL field shows the current address.
    Does the firewall block me when I log in a lot?
    Administrators are never blocked. Other IP addresses are locked out of logging in for 15 minutes after 20 failed logins.
    What happens if a user loses their two-factor phone?
    Press Reset next to them in the Two-factor sign-in card. They can then sign in with their password and set two-factor up again.

    Let MaintainHQ run the routine

    Updates with automatic rollback, backups, uptime, security checks and client reports, with Gus to fix what breaks.

    Start free trial

    From £29 a month for up to 2 sites. Every plan starts with a 14-day trial.