WordPress Security Hardening Checklist

Checked: 14 November 2026 — against WordPress 7.1.4.

How this was checked: every setting, command and file permission on this page was re-checked against the official WordPress hardening guide on developer.wordpress.org and the WordPress 7.1.4 release notes on wordpress.org. The server-level commands (SSH, UFW, Fail2ban, nginx) were checked against Ubuntu/Canonical documentation and the WP-CLI handbook. Where a step could not be verified, it is marked as such on the page instead of being stated as fact. The 25 checklist items themselves were confirmed present in the page on 13 November 2026. No step on this page was tested on a live site for this update — test server-level changes on staging first.

The short version

  • Most WordPress break-ins do not start with WordPress itself. Patchstack’s State of WordPress Security in 2026 counted 11,334 new vulnerabilities in 2025 — 91% of them were in plugins and only 6 in WordPress core. Outdated plugins, weak logins and missing backups are the doors that get used. (91% is the share of disclosed vulnerabilities, not the share of successful hacks — but it tells you where to look first.)
  • Work in priority order, not top to bottom. Logins and accounts first, then updates, then files and wp-config.php, then backups, then the server. The order is in “Work in this order” below.
  • If you only have 30 minutes, do the three steps in “Where to start if you only have 30 minutes” — they are unchanged and still the right first three.
  • On shared hosting, skip the server section. The SSH, UFW and Fail2ban steps need a VPS or dedicated server where you control the operating system. If your host manages the server, ask them what they already do — do not paste server commands into a shared-hosting panel.
  • No checklist makes a site impossible to hack. WordPress’s own hardening guide says the same thing: security is risk reduction, not risk elimination. What this checklist does is remove the easiest ways in and make recovery much faster.

This WordPress security hardening checklist covers the measures that block the most common attacks: weak or reused passwords, outdated plugins, unnecessary admin accounts and missing backups. Tick each item as you complete it. Ticks are saved only in your browser, and Print checklist gives you a paper copy.

This checklist does not scan or secure your site automatically. It lists actions for you or your developer to take. No checklist makes a site impossible to hack, but these steps remove the easiest ways in and make recovery much faster.

Work in this order

The 25 items below are grouped so you can work through them in the order that stops the most common attacks first. Do the groups in this order — inside a group, any order is fine. The server steps are not checklist items; they live in the “Server-level hardening” section below the checklist.

  1. Logins and accounts first. Weak and reused passwords and extra administrator accounts are the fastest way in. Change weak admin passwords, turn on two-factor authentication, and remove admin accounts nobody uses. A stolen admin login can install code, so this group protects everything below it.
  2. Updates second. Update WordPress core, every plugin and every theme, then delete the plugins and themes you do not use. An unused plugin still runs code and still needs updating — deleting it removes the risk entirely. See our guide to WordPress auto-updates for a per-plugin update policy.
  3. Files and wp-config.php third. Set directory permissions to 755 and file permissions to 644, lock wp-config.php down to 440 or 400, turn off the dashboard file editor with DISALLOW_FILE_EDIT, and force admin sessions over HTTPS with FORCE_SSL_ADMIN. These steps limit what an attacker can do after getting in. See wp-config.php security.
  4. Backups fourth — before you change anything risky. Confirm you have a recent backup stored away from the server, and that you know how to restore it. A backup you have never restored is a hope, not a plan. See how to back up a WordPress site.
  5. Server last, then incident response. Only if you run your own VPS or dedicated server: SSH keys, the firewall, Fail2ban and XML-RPC blocking (see “Server-level hardening” below the checklist). These protect the machine WordPress runs on. If you are on shared hosting, this does not apply to you — your host owns it. The checklist’s last group, “If something goes wrong”, is the incident-response set — use it when something has already happened, not as a hardening step.

0 of 25 done

Accounts and access
Software and code
Configuration
Backups and monitoring
If something goes wrong

If something is already wrong, start here

Hardening prevents the next attack. If one of these is already happening, it is a symptom, not a hardening task — follow the linked guide first, then come back to this checklist.

SymptomLikely causeWhere to look
Hundreds of failed logins in a day, or login attempts from countries you have no users inBrute-force bots guessing passwords at wp-login.phpStop brute-force login attacks — then check Users for accounts you did not create
A new administrator account you did not createThe site is already compromised — someone got in and made themselves an adminIs my WordPress site hacked? — do not start with hardening; contain and clean first
Visitors are redirected to spam sites, or strange links appear in search resultsInjected redirect malware, often hidden in a plugin or theme fileWordPress site redirecting to spam and Is my WordPress site hacked?
Files changed that you did not touch, or unknown .php files inside wp-content/uploadsAn uploaded shell or a modified core/plugin fileVerify WordPress core files — run wp core verify-checksums and wp plugin verify-checksums --all, and search wp-content/uploads for .php files (there should be almost none)
The site breaks or shows a white screen right after an updateA bad plugin, theme or core updateRoll back a WordPress plugin update and WordPress auto-updates for a safer update policy
Browsers warn “Your connection is not private”, or the padlock is missing on some pagesHTTPS not fully enforced, or mixed content (some images, scripts or styles still loading over HTTP)WordPress mixed content warnings
xmlrpc.php is hit thousands of times a day in the access logXML-RPC abuse — password guessing and pingback spam through a file most sites no longer needDisable XML-RPC in WordPress — check first that nothing you use (Jetpack, the mobile app) needs it
Your backup restore fails, or you cannot find a backup stored off the serverAn untested backup — or no backup at allHow to back up a WordPress site and the WordPress backup and recovery checklist

Server-level hardening (VPS or dedicated server only)

Everything above works on any hosting. This section does not. It needs a server where you have SSH access and control of the operating system — a VPS or dedicated server. If you are on shared hosting, skip this whole section. Your host controls the firewall, SSH and the web-server configuration; ask them what they already do instead of pasting commands into a hosting panel. Every command below was checked against official or standard documentation on 14 November 2026. Back up the server (or at least take a snapshot) before changing any of it, and test on staging first.

1. SSH: keys only, no passwords

Password logins over SSH are guessed thousands of times a day. Key-only login removes that entirely.

  1. On your own computer (never on the server), create a key:
    ssh-keygen -t ed25519 -C "your-email@example.com"
  2. Copy the public key to the server (this asks for your password one last time):
    ssh-copy-id -i ~/.ssh/id_ed25519.pub user@your-server
  3. Open a new terminal and log in — it should let you in without a password prompt (apart from your key passphrase, if you set one). Do not go further until this works.
  4. On the server, create a drop-in file that sorts first, so it wins over any cloud-image defaults:
    sudo nano /etc/ssh/sshd_config.d/00-keys-only.conf
    PubkeyAuthentication yes
    PasswordAuthentication no
    KbdInteractiveAuthentication no
    PermitRootLogin prohibit-password
  5. Check the syntax and the effective settings before reloading:
    sudo sshd -t
    sshd -T | grep -Ei '^(passwordauthentication|kbdinteractiveauthentication|permitrootlogin|pubkeyauthentication)'
    passwordauthentication must read no. If it still reads yes, another file is setting it first — find it with grep -ri 'PasswordAuthentication' /etc/ssh/sshd_config /etc/ssh/sshd_config.d/ before you reload.
  6. Reload SSH: systemctl reload ssh
    Lockout warning: keep your current SSH session open while you test. An open session is not affected by reloading SSH, so if something goes wrong you can still fix it. Turning off password login while key login is still broken is how lockouts happen.

2. Firewall: UFW — allow SSH first, then switch it on

UFW is Ubuntu’s default firewall tool and is disabled by default. The order matters: allow SSH before you enable it, or you lock yourself out.

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose

If SSH runs on a custom port, allow that port instead (for example sudo ufw allow 2222/tcp). To slow password guessing at the firewall as well: sudo ufw limit ssh. Open only the ports the server actually needs — every open port is a door.

3. Fail2ban: ban IPs that keep failing logins

Fail2ban watches log files and temporarily bans an IP address after repeated failures. It is a complement to the firewall, not a replacement for strong passwords.
Two things to know before you start: Fail2ban ships with no built-in WordPress filter — WordPress login protection needs a custom filter you write yourself. And never edit jail.conf — package updates overwrite it; put your jails in jail.local.
Example custom filter (test it before enabling — see the warning below). Create /etc/fail2ban/filter.d/wordpress-login.conf:

[Definition]
failregex = ^<HOST> -.*"POST /wp-login\.php
            ^<HOST> -.*"POST /xmlrpc\.php
ignoreregex =

Then add the jail to /etc/fail2ban/jail.local:

[wordpress-login]
enabled  = true
port     = http,https
filter   = wordpress-login
logpath  = /var/log/nginx/access.log
maxretry = 5
findtime = 10m
bantime  = 2h

If your server runs Apache, point logpath at your Apache access log instead. If you use Jetpack or the WordPress mobile app, remove |xmlrpc\.php from the filter — or better, block xmlrpc.php at the server (step 4) and leave it out of the jail entirely.
Test before you enable: run the filter against your real log without banning anyone:
sudo fail2ban-regex /var/log/nginx/access.log /etc/fail2ban/filter.d/wordpress-login.conf
Only enable the jail when the matches are the lines you expect. A filter that matches normal traffic will ban your own users.
Why this works: a failed WordPress login returns HTTP 200 (the login form is shown again with an error), while a successful login returns 302 (redirect to the dashboard). The filter counts the repeated POSTs, not the error message.

4. Block xmlrpc.php at the server

xmlrpc.php is an old remote-publishing interface. Most sites no longer need it — the REST API does the same jobs — but it is still enabled by default and is a popular target for password guessing and pingback abuse. Blocking it at the server stops the request before WordPress even loads.
Apache or LiteSpeed — add to the .htaccess file in the site root, outside the # BEGIN WordPress / # END WordPress block (WordPress overwrites anything between those tags):

<Files xmlrpc.php>
    Require all denied
</Files>

nginx — add inside the server block, before the general PHP location, then test and reload (nginx -t, then reload):

location = /xmlrpc.php {
    deny all;
}

A request to xmlrpc.php should now return 403. Check first that nothing you use needs it: Jetpack, the WordPress mobile app and some backup and migration plugins speak XML-RPC, and blocking it will break them without a clear error message. Full detail, including the Jetpack exception, is in our Disable XML-RPC in WordPress guide.

5. Stop PHP running inside wp-content/uploads

The uploads folder is the one directory that accepts files from users. If an attacker can place a .php file there and the server runs it, they have a shell. Blocking execution there means an upload bypass produces a useless file instead of a foothold — and normal media is unaffected, because uploads should never contain code.
Apache or LiteSpeed — create a .htaccess file inside wp-content/uploads:

<FilesMatch "\.(php|phtml|php3|php4|php5|php7|phps)$">
    Require all denied
</FilesMatch>

nginx — add to the server block, before the general PHP handler (nginx does not read .htaccess files at all, so the Apache rule does nothing on nginx):

location ~* ^/wp-content/uploads/.*\.php$ {
    deny all;
}

Test it: put a harmless file such as test.php containing <?php echo "PHP runs here"; ?> in the uploads folder and request it in a browser. You should get 403 Forbidden. If you see the text, PHP is still executing — and delete the test file either way.

6. Rotate the salts after staff changes or an incident

The eight AUTH_KEY to NONCE_SALT values in wp-config.php sign every login cookie. Rotating them logs everyone out, including any attacker holding a stolen session — that is the point. There is no published schedule for this in the official docs; do it when someone with access leaves, after any suspected compromise, and after a hosting breach.
With WP-CLI (preferred — it rewrites the values in place, so the file’s owner and permissions do not change):

wp config shuffle-salts

Without WP-CLI, fetch a fresh block from the official generator and replace the eight lines by hand:

curl -s https://api.wordpress.org/secret-key/1.1/salt/

Copy wp-config.php first, and warn your team that everyone will need to log in again. The file’s own comment says the same thing: changing these values “will force all users to have to log in again.”

Frequently asked questions

Does this checklist make my site impossible to hack?

No. Nothing does. WordPress’s own hardening guide puts it plainly: security is risk reduction, not risk elimination. What the 25 items do is remove the easiest ways in — weak logins, outdated plugins, open file permissions, missing backups — and make recovery much faster when something does go wrong. A site that follows this checklist is a harder target, not an invulnerable one.

I am on shared hosting. Can I do the server-level steps?

No — and you should not try. SSH keys, UFW, Fail2ban and nginx rules need a VPS or dedicated server where you control the operating system. On shared hosting your host owns that layer. What you can do is everything in the checklist itself, plus ask your host two questions: do they already block xmlrpc.php and PHP execution in uploads, and do they rate-limit logins? If they cannot answer, that tells you something about the host.

Will blocking xmlrpc.php break anything I use?

It breaks anything that still speaks XML-RPC: Jetpack, the WordPress mobile app, and some backup, migration and remote-publishing tools. Before blocking it, check whether any of those are in use on your site. If Jetpack is essential, allow only Jetpack’s published IP ranges instead of denying everything. If nothing uses it, block it — the file is a favourite target for password guessing and pingback abuse. See Disable XML-RPC in WordPress for the full check.

I rotated the salts and everyone got logged out, including me. Is that normal?

Yes — that is exactly what salt rotation does. The eight keys and salts sign every login cookie, so changing them invalidates all existing sessions at once. Everyone, including you and including any attacker holding a stolen session, has to log in again. Warn your team before you do it, and do it during a quiet moment.

My site is already hacked. Should I start with this checklist?

No. Hardening a compromised site first is like fitting a new lock while someone is already inside. Contain and clean first: confirm the hack, back up the infected state for evidence, remove the malicious code or restore from a known-clean backup, change all passwords and rotate the salts — then work through this checklist so it does not happen again. Start with Is my WordPress site hacked?

Related guides

Where to start if you only have 30 minutes

  1. Change any reused or weak administrator passwords and turn on multifactor authentication.
  2. Update everything and delete unused plugins and themes.
  3. Confirm you have a recent backup stored away from the server.

For more background, read the official WordPress hardening guide. For ongoing upkeep, use the WordPress maintenance checklist.