By framework
WordPress security — a production hardening reference
A WordPress production-hardening reference: a priority checklist plus updates, plugin/theme management, admin 2FA, reducing admin exposure, wp-config and secrets, files, and backups, with a self-verification checklist. Defensive, no attack steps.
For: anyone running a WordPress site. No attack steps here — this is a working reference for hardening: a priority-ordered checklist, per-area guidance, and self-verification. For the cross-framework picture, see the security-by-framework hub.
Priority-ordered hardening checklist
Do this table top-down. P0 is top priority, P1 is the most frequent source of incidents, P2 is ongoing operational hygiene.
P0 ── Prerequisite (do first)
Automatic updates / delete unused plugins & themes / strong admin + 2FA
P1 ── Top source of incidents
Minimize plugins / reduce admin exposure / recoverable backups
P2 ── Operational hygiene
wp-config and secrets / file permissions / HTTPS, headers, PHP/dependency freshness
| Priority | Control | Specifics (WordPress) |
|---|---|---|
| P0 | Automatic updates | Enable auto-updates for core, plugins, themes. Back up before major updates |
| P0 | Delete the unused | Delete unused plugins/themes, don't just deactivate (leftover files are still a target) |
| P0 | Strong admin + 2FA | Strong password + two-factor. Avoid the admin username; least-privilege roles |
| P1 | Minimize plugins | Vet update frequency, adoption, known CVEs before installing. Keep the count low |
| P1 | Protect login | Login-attempt limits. Restrict exposure of wp-admin/wp-login.php |
| P1 | Reduce exposure | Restrict xmlrpc.php if unused. Suppress REST-API user enumeration |
| P1 | Backups | Offline/separate recoverable backups + restore tests + tamper detection |
| P2 | wp-config & secrets | Set authentication keys/salts, protect wp-config.php, disable debug display in prod |
| P2 | File permissions | ~644 files / 755 dirs. Disallow PHP execution in the uploads dir |
| P2 | HTTPS/headers/updates | Force HTTPS, HSTS, etc. Keep PHP/DB on supported versions |
1. Updates (the top defense)
Most attacks on WordPress are automated tools hitting a published known vulnerability (CVE) at scale. So update speed is your biggest defense.
- Enable automatic updates for core, plugins, and themes — close published holes before they're hit.
- For important sites, verify major updates in staging and back up before updating.
- A skipped update is an open entry for automated attacks. Don't "do it later."
2. Plugins and themes (attack surface)
Third-party code vulnerabilities are the biggest entry. The key is to keep the count low and never leave them unattended.
- For anything unused, delete rather than deactivate (deactivated files can still be a target).
- Before installing, check update frequency, adoption, last-updated date, and known CVEs. Avoid abandoned ones.
- You can check plugin CVEs with the CVE/KEV lookup. Fewer extensions means less update responsibility and less attack surface.
3. Admin accounts and authentication
Most takeovers are brute-force against weak/reused admin accounts, or reuse of leaked passwords.
Common (dangerous)
- username
admin+ weak password + no 2FA - everyone is an administrator (no role separation)
- unlimited login attempts
wp-adminreachable from anywhere
Correct
- strong password + 2FA, a username other than
admin - least-privilege roles (use editor/author appropriately)
- login-attempt limits (curb brute force)
- where possible, restrict where
wp-admin/wp-login.phpcan be reached from
For choosing 2FA see what 2FA is; for the route that targets admins see what phishing is.
4. Reduce exposure (admin surface and disclosure)
Attackers first look for a "usable entry." Cut unused features and unnecessary disclosure.
- Add login-attempt limits to reduce the effectiveness of brute force.
- Restrict
xmlrpc.phpif unused (it can be an entry for brute-force amplification and high-volume requests). - Suppress REST-API user enumeration (prevent exposing admin names via
?author=etc.). - Disable directory listing and reduce unnecessary version disclosure.
- Disable file editing from the admin (
DISALLOW_FILE_EDIT) to make post-intrusion tampering harder.
5. wp-config and secrets (P2)
- Set the unique authentication keys/salts and protect
wp-config.phpwith appropriate permissions (never world-readable). - Keep secrets like DB credentials off the public surface. Don't leave backups or exports in a public directory (→ keep secrets out of public directories).
- In production, disable debug display (
WP_DEBUG_DISPLAYoff). Don't leak internals via errors.
6. Files and uploads (P2)
- File permissions of roughly 644 files / 755 dirs, and stricter for
wp-config.php. Never leave anything world-writable. - Don't allow PHP execution in the uploads directory (web-shell defense). Validate upload type and size.
- Use tamper detection (file-change monitoring) to spot post-intrusion changes early.
7. HTTPS, headers, backups (P2)
- Force HTTPS + HSTS. Resolve mixed content.
- Add security headers (check your own site with the security headers checker).
- Keep offline/immutable backups + restore tests so you can recover (→ backup essentials). The last line against ransomware and defacement.
8. Hosting and dependencies (P1–P2)
- Keep PHP and the database on supported versions. Don't leave EOL versions in place.
- Know your hosting's patch status (on shared hosting, that includes the provider's response).
- A WAF is a supplement — firm up the foundation (updates, minimization, auth, backups) first.
Verify: is your WordPress actually hardened?
Building it isn't the end — it's done only once you've checked. These are defensive self-checks against your own site.
Secrets and config aren't exposed
/wp-config.php doesn't return its contents, and that backups (.zip/.sql) or .env-type files aren't fetchable by URL.Admin names and versions aren't leaking
?author=1 and similar don't expose an admin username, and that directory listing is off.Login protection and 2FA work
admin user remains.Updates, backups, headers
This site's view: manage 'extensions and neglect,' not the core
What works for WordPress isn't flashy config but the operational discipline of "don't over-add extensions, don't leave them unattended." Plugins are convenient, but each one adds a responsibility to keep updating. The center of gravity is working the table above top-down — automate updates, keep plugins minimal, and defend with strong auth and recoverable backups. It looks WordPress-specific but is really the universal foundation (dependency freshness, minimal public surface, authentication, recovery) applied.
Read next
- Hub: security by framework · Laravel security
- Practice: the vulnerability-response playbook · backup essentials
- Secrets/auth: keep secrets out of public directories · what 2FA is · what phishing is
- Tools: security headers checker · CVE/KEV lookup
FAQ
QWhat should I do first to secure WordPress?
The three P0 items: (1) enable automatic updates for core, plugins, and themes so published known vulnerabilities (CVEs) are closed before they're hit; (2) delete unused plugins/themes (not just deactivate) to cut the attack surface; (3) protect admin accounts with a strong password and two-factor authentication (2FA), and avoid the username admin. These three alone stop most automated attacks. Next, reduce admin exposure and set up backups.
QHow many plugins is too many?
The rule is 'only the minimum you need.' Each plugin adds attack surface and a 'responsibility to keep updating.' Before installing, check update frequency, adoption, last-updated date, and known vulnerabilities; and for anything unused, delete rather than deactivate (deactivated files can still be a vulnerability target). The same goes for themes.
QShould I disable xmlrpc.php?
If you don't use it, restricting or disabling it is recommended. xmlrpc.php serves remote posting and pingbacks, but it can also be an entry for brute-force amplification and high-volume requests. If you do use features that need it (some app integrations), limit it to the methods you need or protect it with rate/IP limits. Check whether you actually use it first.
QDoes a security plugin make me safe?
A security plugin helps but isn't a silver bullet. Bolting one on while the foundation (automatic updates, minimal plugins, strong admin auth, backups, reduced admin exposure) is missing won't close the holes. Work the checklist on this page first, then use a plugin to supplement things like login-attempt limits and tamper detection.
QWhat's the bare minimum?
(1) automatic updates, (2) delete unused plugins/themes, (3) strong password + 2FA for admins, (4) login-attempt limits and reduced admin exposure, (5) recoverable offline backups + tamper detection. These five stop most automated attacks. See the checklist and sections above for detail.