WordPress Security Hardening: The Complete Checklist for 2026

A tested WordPress security hardening checklist for 7.1.4 and PHP 8.3+: updates, 2FA, roles, file locks, uploads, XML-RPC, backups and WAF.

Checklist card reading Lock down WordPress with ticked items for updates, two-factor login, least-privilege roles, no PHP in uploads and tested backups

WordPress security hardening comes down to a short list: keep core, plugins and PHP current, put two-factor on every account that can publish or administer, give each person the lowest role that does the job, stop PHP from running in the uploads folder, and keep tested backups off the server. Everything else on a checklist is either a smaller win or something your host already does. This guide covers the full list for WordPress 7.1.4 (the current stable release, a security update from 28 October 2026) on PHP 8.3 or newer, which is what WordPress.org recommends today.

Each section gives the setting, the code, and what it can break. We checked every constant, filter and command against the official WordPress documentation on 15 November 2026 and tested the Apache rules on Apache 2.4.67 before printing them. Where a rule has a real downside, we say so.

What is the short version of a WordPress hardening checklist?

Work top to bottom. The first rows stop the attacks that happen most often, the last rows limit the damage after something slips through.

Control

Where it is set

Effort

What it can break

Updates for core, plugins, themes

Dashboard, WP-CLI, host

Low

Rarely a plugin conflict, so keep a backup first

Two-factor on admin and editor accounts

Plugin, per user

Low

Lockout if backup codes are lost

Least-privilege roles and a short admin list

Users screen, WP-CLI

Low

Staff who lose a capability they used

Disable the file editor

wp-config.php

Trivial

Plugins that check the edit capabilities

Block all file changes from the dashboard

wp-config.php

Trivial

Also blocks automatic updates

Fresh salts after any suspected leak

wp-config.php, WP-CLI

Trivial

Logs every user out

Sane file permissions and ownership

Server

Low

Updates that cannot write files

No PHP execution in uploads

Apache or nginx config

Low

Nothing, if no plugin stores PHP there

XML-RPC off if unused

Server and a filter

Low

Jetpack and the mobile apps

Application passwords reviewed

Profile screen, filter

Low

REST clients and automations

Off-server, tested backups

Host or plugin

Medium

Storage cost

Web application firewall

CDN, host or plugin

Medium

False positives on forms and checkout

Monitoring and alerts

Uptime, file and log checks

Medium

Alert fatigue if tuned badly

Our top Search Console query for this page is “wordpress security hardening”, so we kept the structure close to how people phrase the question. Sections below are questions you can jump to.

How should you handle WordPress, plugin and PHP updates?

Update on a schedule and treat the plugin list as the main attack surface. The WordPress.org handbook states that older WordPress versions are not maintained with security updates, so running behind is a choice with a cost. Minor core updates are on by default. The handbook says fresh installs from 5.6 on also get major core updates unless a version control checkout is detected, and it discourages turning minor and translation updates off.

Plugins and themes do not update themselves unless you opt in. The dashboard has a per-plugin toggle, and developers can set the policy in code with the auto_update_{$type} filter (available since WordPress 3.7). Check what is pending from the command line:

# checked on 15 Nov 2026
wp core check-update
wp plugin list --update=available
wp theme list --update=available
wp plugin update --all

The core auto-update constant accepts three values. We leave it at the default unless a site has a staging flow that justifies full automation.

// wp-config.php - checked on 15 Nov 2026
define( 'WP_AUTO_UPDATE_CORE', 'minor' ); // default: minor releases only
// true  = minor and major releases
// false = no automatic core updates

PHP matters as much as WordPress. The WordPress.org requirements page recommends PHP 8.3 or newer, and MariaDB 10.11 or newer or MySQL 8.4 or newer. It says PHP 7.4 and MySQL 5.5.5 still run WordPress for legacy setups but are end-of-life and may expose your site to security vulnerabilities. Ask your host which PHP you run, and move to a supported branch on staging first.

Remove what you do not use. A deactivated plugin still sits on disk, and its files can still be requested directly. Delete unused plugins and themes instead of leaving them parked. After any update, confirm the files still match WordPress.org:

# checked on 15 Nov 2026
wp core verify-checksums
wp plugin verify-checksums --all

Both commands compare files with the checksums published by WordPress.org. Premium plugins and plugins hosted elsewhere have no WordPress.org checksum, so they cannot be verified this way. For a real example of why speed matters, see our write-up of the WordPress 7.1.2 path traversal fix.

Do you need two-factor authentication on every account?

You need it on every account that can publish, install code or manage users. A stolen password is still the easiest way in, and a second factor turns a leaked password into a dead end. WordPress core does not ship two-factor login. The Two Factor plugin on WordPress.org is the community-maintained option: version 0.17.0, 100,000+ active installs, rated 4.8 out of 5 from 209 ratings, last updated 28 September 2026 and tested with 7.1.4 (data checked 15 November 2026).

Three details from its documentation decide how you roll it out. Authenticator-app codes (TOTP) and backup codes are the recommended methods, and email codes also exist. There is no setting to require two-factor for a role, so enforcement needs custom code or a separate plugin. And passkeys or hardware keys need a separate WebAuthn provider plugin. The WordPress handbook also notes that SMS is a weak channel and recommends a phone app instead.

Wordfence, Duo and Rublon are other options named in the handbook. Pick one, make backup codes mandatory at enrolment, and store a recovery path (a second admin with a hardware key works) before you switch it on for everyone.

How do you set up least-privilege roles?

Give every person the lowest role that still lets them work, and keep the number of administrators to the people who install plugins or change settings. An Editor can manage all posts but cannot install code. An Author manages only their own posts. A Contributor writes without publishing. Most “I need admin” requests turn out to be a request for one capability that you can grant to a smaller role.

List your administrators today and look at the registration dates. An unknown account, or one created at an odd hour, is a signal worth chasing:

# checked on 15 Nov 2026
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered --format=table

The same discipline applies to the database. The hardening handbook explains that normal operation needs SELECT, INSERT, UPDATE and DELETE on the WordPress database, and it also warns against revoking DROP, ALTER and GRANT unless you have a tested backup plan, because major updates can change the schema. Give each site its own database and its own database user.

Should you use DISALLOW_FILE_EDIT or DISALLOW_FILE_MODS?

Use the editor lock on almost every site, and think twice before the full lock. The two constants sound alike but do different jobs, and mixing them up is a common cause of silent update failures.

Constant

What it blocks

Typical use

The file editor constant (DISALLOW_FILE_EDIT)

The theme and plugin code editor in the dashboard

Every site

The file modifications constant (DISALLOW_FILE_MODS)

Plugin and theme installs and updates, and also the editor

Sites deployed from Git or Composer

// wp-config.php - checked on 15 Nov 2026
define( 'DISALLOW_FILE_EDIT', true );   // disables the code editor only
define( 'DISALLOW_FILE_MODS', true );   // disables installs, updates and the editor

The handbook describes the first as equivalent to removing the edit_themes, edit_plugins and edit_files capabilities, and it adds a limit: it does not stop an attacker from uploading malicious files. The second also disables the editor, so you never need both. The wp_is_file_mod_allowed() reference lists WP_Automatic_Updater::is_disabled() among its callers, which is why the full lock can stop background updates too. If your deployment pipeline updates code instead of the dashboard, that is fine. If it does not, you have traded one risk for another. The page also exposes a file_mod_allowed filter for the exceptions.

To set the editor lock without opening the file:

# checked on 15 Nov 2026
wp config set DISALLOW_FILE_EDIT true --raw

Do you need to rotate WordPress salts?

Rotate them after any suspected breach, after an admin leaves under bad terms, and whenever a backup with your wp-config.php may have leaked. The authentication keys and salts sign login cookies. Replacing them invalidates every existing session, so everyone is logged out. The WordPress.org “site was hacked” guide gives exactly this advice: generate a new set and overwrite the values in wp-config.php to force anyone still logged in off.

# checked on 15 Nov 2026
wp config shuffle-salts

The command fetches fresh values from the WordPress.org secret-key service and rewrites the salt constants in wp-config.php. It needs write access to that file, which is one reason some teams prefer to paste values from the generator by hand. There is no value in rotating on a timer for its own sake. On a healthy site, a yearly rotation is a habit, not a defence.

What file permissions should WordPress use?

Directories at 755 and files at 644, owned by your user account, with the web server process writing only where it must. That is the handbook’s own recommendation, and the same pair WordPress uses for automatic updates.

# checked on 15 Nov 2026 (replace the path)
find /path/to/wordpress/ -type d -exec chmod 755 {} \;
find /path/to/wordpress/ -type f -exec chmod 644 {} \;
  • Root, wp-admin and wp-includes: writable only by your user account.
  • wp-content: writable by your user and the web server, because uploads and caches live there.
  • wp-content/plugins: writable only by your user account if you update through SSH or a pipeline.
  • wp-config.php: the handbook says it generally means 400 or 440 for read access, and notes it may be kept one directory above the install. Use the tightest mode your PHP user can still read.

Never use 777 as a quick fix for a failed update. Those errors usually mean the PHP user cannot write in a parent folder, and the right repair is ownership, not world-writable files.

How do you block PHP execution in the uploads folder?

Tell the web server never to run PHP from wp-content/uploads. WordPress stores images and documents there and never needs it to run code, so this closes a favourite landing spot for attackers who find any upload bug. It is the single most useful server rule on this list.

Apache 2.4

Put this file at wp-content/uploads/.htaccess. We tested it on Apache 2.4.67: a PHP file in uploads returned 403 while a text file returned 200.

# wp-content/uploads/.htaccess - checked on 15 Nov 2026
<FilesMatch "(?i)\.(php|php[0-9]|phtml|phar|pht)$">
    Require all denied
</FilesMatch>

The server needs AllowOverride set so .htaccess files are read. If you control the virtual host, put the same block in the host configuration instead, which is also faster because the server does not look for .htaccess files on every request.

nginx

nginx has no .htaccess, so the rule lives in the server block. Order matters: the nginx documentation says regular expression locations are checked in file order and the first match wins, so this rule must sit above your general PHP location.

# in the server block, above the generic PHP location - checked on 15 Nov 2026
location ~* ^/wp-content/uploads/.+\.(php|php[0-9]|phtml|phar|pht)$ {
    return 403;
}

Reload nginx and request a test file such as /wp-content/uploads/test.php. You want 403, not a blank page and not the source. We did not have nginx on the test machine, so this one is verified against the nginx matching rules rather than a live run; test it on staging first.

Should you disable XML-RPC?

Disable it when nothing you use needs it. XML-RPC is the older remote-publishing interface at xmlrpc.php. Plenty of sites never use it, and it is a long-standing target for password guessing because one request can try many logins. The catch is that Jetpack and the WordPress mobile apps can depend on it.

The filter is narrower than its name suggests. The xmlrpc_enabled reference says it only controls the methods that need authentication. It does not fully disable XML-RPC and does not affect pingbacks. To close the door, block the file at the server as well.

<?php
// wp-content/mu-plugins/hardening.php - checked on 15 Nov 2026
add_filter( 'xmlrpc_enabled', '__return_false' );
# site root .htaccess, Apache 2.4 - checked on 15 Nov 2026
<Files "xmlrpc.php">
    Require all denied
</Files>

Request /xmlrpc.php afterwards. A blocked file returns 403. A healthy but unblocked endpoint answers with a short message saying it accepts POST requests only. If Jetpack reports a connection error after this change, that is the reason, so undo it or allow Jetpack’s traffic.

What about application passwords?

Application passwords let a script or app call the REST API as a user without the main password. They arrived in WordPress 5.6, they can be revoked one at a time, and every one is a standing credential. Review them the way you review SSH keys. On a user profile, scroll to Application Passwords and delete what you do not recognise, or use WP-CLI:

# checked on 15 Nov 2026
wp user application-password delete <user> --all

If no integration on your site needs them, remove the feature with the wp_is_application_passwords_available filter:

<?php
// wp-content/mu-plugins/hardening.php - checked on 15 Nov 2026
add_filter( 'wp_is_application_passwords_available', '__return_false' );

That also breaks any headless front end, mobile app or automation that authenticates this way, so check first. Our REST API authentication guide lists the alternatives.

Which login and wp-admin protections are worth the effort?

Force HTTPS for the admin area, and skip the tricks that add friction without real protection. Add this once your certificate works, because the handbook notes SSL must already be configured on the server:

// wp-config.php - checked on 15 Nov 2026
define( 'FORCE_SSL_ADMIN', true );

Behind a reverse proxy that terminates SSL, the same page warns this can cause a redirect loop unless WordPress knows the request was HTTPS. The headers and HSTS belong at the server level, which we cover in our security headers guide.

Two measures we do not recommend as defaults. Password-protecting the whole wp-admin directory breaks admin-ajax.php, which front-end features use, as the handbook itself warns. Renaming wp-login.php hides the URL from lazy scans but does nothing against a targeted attack, and it tends to confuse your own team. A changed database table prefix is the same story: the handbook says it can block some SQL injection, but it is a minor measure once queries are prepared and plugins are patched.

Rate-limit logins at the server, CDN or firewall instead. That stops password guessing without changing a single URL.

How should WordPress backups work?

A backup counts only if it includes the database and the files, lives somewhere an attacker on your server cannot reach, and has been restored at least once. The handbook’s own guidance is to keep at least three recent copies in different places and to back up before every upgrade. Smaller sites can often manage weekly, while busy sites need daily.

  • Include both database and files. Core, plugins, themes, uploads, wp-config.php and .htaccess are all needed for a full restore.
  • Store a copy off the server, in storage that your WordPress credentials cannot delete.
  • Keep several dates. A backup taken after an infection can carry it forward.
  • Restore into a staging site every quarter and load three pages. An untested backup is a hope.

Our backup strategy guide walks through plugin options and WP-CLI exports. After a hack, the WordPress.org guide also says to take one more snapshot of the infected state before cleaning, so you have something to study.

Do you need a web application firewall?

A firewall is worth having, and it sits in front of the other items, not instead of them. It filters known attack patterns before they reach PHP. There are three places to run one, with different trade-offs.

Where

Strength

Limit

CDN or DNS-level service

Blocks traffic before it reaches your server

Another service to configure, and false positives on forms

Host-level firewall

Often included and tuned by the host

You cannot see or change most rules

Plugin firewall (for example Wordfence)

Knows WordPress internals, easy to start

Runs inside PHP, so it only sees requests that already reached your server

For scale: Wordfence on WordPress.org shows version 9.1.1, 5,000,000+ active installs, 94 out of 100 average rating from 5,050 ratings, and 152 of 177 recent support threads resolved (checked 15 November 2026). Treat any firewall as a layer. A patched plugin beats a firewall rule every time, and firewalls cannot fix weak passwords.

What should you monitor, and with what?

Monitor three things: whether the site is up, whether files changed, and whether new users or admins appeared. The hardening handbook lists logs and file-change monitoring (OSSEC, inotify or Git) as the way to notice a compromise early. Your own checks can be small:

  • Uptime and response time from outside your network. Our uptime monitoring guide compares tools.
  • File integrity: the two verify-checksums commands above on a weekly schedule, or a Git diff if your code is in version control.
  • A weekly look at the administrator list from the earlier command.
  • Google Search Console and Bing Webmaster Tools, which the WordPress.org hacked-site guide recommends for blacklist warnings.

We build one tool in this area, WP Vanguard, a hosted scanner. A surface scan checks what an outsider can see: SSL, headers, blacklists, exposed files and known vulnerabilities for detected versions. A deep scan needs SSH access to run WP-CLI checks. The real cons: it is a hosted service, so you must be comfortable giving SSH access for the deep scan; an external scan cannot see everything inside the server; and it detects problems, it does not replace updates, backups or a firewall. If you only need file and login monitoring, the checks above cost nothing.

What mistakes do people report when they harden WordPress?

These are the problems we see repeatedly in forum threads and developer discussions. Each one comes from a good control applied without checking what depended on it. Checked 15 November 2026.

  • Locking file changes and losing automatic updates. People set DISALLOW_FILE_MODS and then wonder why minor updates stopped. A Roots community thread describes minor updates not running with the constant on, and the core team’s auto-update guide explains the update constants and filters. Decide who updates the site before you set it.
  • Blocking xmlrpc.php and breaking Jetpack or the app. Several support threads about Jetpack 403 errors trace back to a server or plugin rule that blocks the file. Check what connects to the site before you block it.
  • Password-protecting wp-admin. Front-end forms and live search call admin-ajax.php, so a directory password breaks them for visitors. Wordfence published a warning about exactly this, and the handbook repeats it.
  • Resetting passwords once, before the site is clean. The WordPress.org hacked-site FAQ says to change them again after cleaning, because the first reset happened while the site was still compromised.
  • Restoring a backup without finding the way in. The same FAQ lists forensics as its own step. A restore that skips it can put the old hole back and invite a repeat.

Frequently asked questions

Is a security plugin enough on its own?

No. A plugin monitors and filters, but it cannot fix an outdated plugin, a weak password or a writable uploads folder. Use one as a layer on top of the checklist.

How often should you review the checklist?

Review it after every major WordPress release, after any staff change, and once a quarter in between. Re-run the administrator list, the checksum commands and a restore test each time.

Does hardening slow the site down?

Server rules and wp-config constants cost nothing measurable. A plugin firewall adds work inside PHP on every request, so a CDN or host-level firewall is lighter for busy sites.

Which PHP version should WordPress run?

PHP 8.3 or newer is what WordPress.org recommends today. Test on staging, then move production, and watch the error log for deprecation notices from older plugins.

What is the first thing to do on a site you just inherited?

Take a full backup, list the administrators, update everything, run both checksum commands, and delete unused plugins and themes. Then work down the table at the top of this page.

Sources checked on 15 November 2026

Varun Dubey

Written by

Varun Dubey

Varun Dubey runs Wbcom Designs, the WordPress studio he founded in India in 2009. He has spent sixteen years building on WordPress and BuddyPress, shipping client work and products such as Reign, BuddyX, Jetonomy and MediaVerse, and has been putting Claude and OpenAI workflows into production since 2023. He writes up what the studio learns along the way.

More about Varun

No comments yet