WordPress Hardening: The 80/20 Checklist

By cluster , 3 July 2022

Hardening guides for WordPress tend to run to forty items, and most of them are presented as equally urgent. They are not. A handful of measures removes most of the realistic risk, and the rest is refinement that can wait for a quiet afternoon.

This checklist covers that handful, in rough order of return, followed by the popular tweaks that are safe to postpone.

Where the risk actually is

A recent annual report from Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in a single year. Plugins accounted for 91% of them, themes for the rest, and WordPress core for six. Almost half had no fix available on the day they were made public, and the most heavily targeted ones were being exploited at scale within a median of five hours.

The other common way in needs no vulnerability at all: a reused or leaked password on an administrator account.

Those two facts set the priorities. Fewer plugins, faster updates, stronger logins: everything else is fine-tuning.

The checklist

  1. Cut the plugin and theme list. Delete what is not in use rather than deactivating it, since inactive code still sits on the server. Replace anything that has been closed in the plugin directory or has gone a long time without a release. Keep one default theme as a fallback and remove the others.

  2. Let updates install themselves. Core security releases are applied automatically by default, so the main job is not to switch that off. When a critical core flaw needs an urgent fix, the WordPress team can push the patch through this same mechanism, and sites with working background updates are covered without anyone logging in. For plugins and themes, auto-updates are opt-in:

    wp plugin auto-updates enable --all
    wp theme auto-updates enable --all

    Where an untested update could break a shop or a booking system, test on staging first, but measure the delay in days. Premium plugins update through their own licence servers, so an expired licence quietly means no security fixes.

  3. Require two-factor authentication for anyone who can publish or install. Administrators and editors first. The Two Factor plugin, maintained by WordPress contributors, covers authenticator apps, email codes and backup codes. Pair it with unique passwords kept in a password manager.

  4. Trim accounts and roles. One administrator account per person who needs one, no shared logins, and no accounts left over from former staff or agencies. Most people who write content need the Editor or Author role, not Administrator.

    wp user list --role=administrator --fields=user_login,user_email
  5. Slow down login attempts and close unused doors. Rate-limit wp-login.php at the host, the firewall or with a plugin. If nothing on the site depends on XML-RPC, block /xmlrpc.php at the server. Review the Application Passwords section in each administrator's profile and revoke any that are no longer used.

  6. Lock down the filesystem. Disable the built-in theme and plugin editor in wp-config.php:

    define( 'DISALLOW_FILE_EDIT', true );

    Set directories to 755, files to 644 and wp-config.php to 400 or 440, as the official hardening guide recommends. The editor setting does not stop a malicious file being uploaded, so also prevent PHP from running in the uploads folder. On Apache, in wp-content/uploads/.htaccess:

    <FilesMatch "\.(?:php|phar|phtml)$">
      Require all denied
    </FilesMatch>

    On Nginx, the equivalent is a location block that denies .php requests under /wp-content/uploads/.

  7. Put a firewall with virtual patching in front of the site. Updates cannot help while a fix does not yet exist. A web application firewall that ships rules for specific WordPress vulnerabilities covers that gap. Generic server-level protection is not a substitute: in Patchstack's tests, hosting providers' standard defences stopped only about a quarter of the attacks.

  8. Keep backups off the server and test a restore. Hardening lowers the odds of a compromise. A backup that has actually been restored decides how bad the day is if one happens anyway.

What can wait

These measures are not harmful, but they return little for the time they take.

  • Moving or hiding the login URL. It reduces noise in the logs. It does not replace two-factor authentication or rate limiting.
  • Changing the wp_ table prefix on a live site. Reasonable on a new install, risky to retrofit, and no defence against a vulnerability that can already read the database.
  • Hiding the WordPress version. Automated scanners try their exploits without checking it first.
  • Switching off the REST API entirely. The block editor depends on it. If user enumeration is the concern, restrict the users endpoint for visitors who are not logged in.
  • Stacking security plugins. Two or three overlapping suites add conflicts and more code to maintain. One well-configured tool is enough.

The official hardening guide makes the same point about obscurity in general: it has its uses, but it is a weak primary strategy.

A ten-minute audit

With WP-CLI, the state of a site can be checked quickly, which matters when there are many sites to look after:

wp core check-update
wp core verify-checksums
wp plugin list --update=available
wp plugin verify-checksums --all
wp plugin auto-updates status --all
wp config get DISALLOW_FILE_EDIT

The checksum commands compare core and plugin files with the official copies and flag anything that has been altered. They only cover plugins hosted on WordPress.org, so premium plugins need a separate check. An error on the last command means the constant has not been set.

In short

Most WordPress sites are not compromised through WordPress itself. They are compromised through something that was added to it or through an account that was easy to take over. Eight measures cover the bulk of that exposure, and none of them requires a specialist.

When time is short, go back to the rule: fewer plugins, faster updates, stronger logins.

Further reading


This article is part of the Security, Hosting & Maintenance series.

More on building and looking after WordPress sites in the WordPress & CMS series.

Changed