The FBI says over 1,000 hacked WordPress sites hid ransomware lures in Google. You can open yours and see a normal page.

Details

WordPress security hardening

Practical WordPress hardening: updates, wp-config, permissions, logins, SSL, plugins, XML-RPC, .htaccess, firewall, scans, and backups in a sensible order.

Topics Hardening & checklists Beginner guides

Updated Published

WordPress security hardening Open larger image: WordPress security hardening

How to secure a WordPress site (do these in order):

  1. Keep WordPress core, plugins, and themes updated every week.
  2. Harden wp-config.php (keys, salts, disallow file edit, move outside web root when possible).
  3. Set sane file and folder permissions on core, content, and uploads.
  4. Use unique passwords, limit failed logins, and enable 2FA on every role that can change the site.
  5. Remove unused plugins and themes from disk.
  6. Use HTTPS end to end, and tighten hosting or edge firewall rules where you control them.
  7. Restrict or disable XML-RPC if you do not need remote publishing.
  8. Run vulnerability scans, malware checks, and integrity tests on a schedule.
  9. Keep offsite backups and restore one before you rely on it.
  10. Run a security plugin you check often (Security Ninja free tests cover a lot; Pro adds firewall and deeper scans).

Below we walk through each step in more detail. Monthly habits live in best practices. The security checklist is the tickable version.

Last updated: 18 November 2026.

WordPress security hardening

WordPress hardening checklist (17 November 2026)

StepWhat to doTimeFree with Security NinjaPro
1Keep core, plugins and themes updated10 min/weekVulnerability scannerDaily definitions refresh, email alerts
2Harden wp-config.php15 minSecurity tests flag it
3Fix file permissions10 minSecurity tests flag it
4Strong passwords, limit logins, 2FA15 minLogin protection, 2FA
5Remove unused plugins and themes10 minSecurity tests flag it
6HTTPS, host and edge protection30 minSecurity tests flag itCloud Firewall
7XML-RPC: restrict, do not blindly disable5 minSecurity tests flag it
8Detect problems earlyOngoingSecurity testsMalware and Core File Scanners, Events Logger
9Backups you can restore30 min(use your host or a backup plugin)
10A security plugin that matches the job10 minFree pluginPro

What you are hardening

Think in layers:

  1. Core and config (wp-config.php, updates, file edit locks)
  2. Plugins and themes (fewer, updated, trusted)
  3. People and logins (passwords, 2FA, roles, failed-login limits)
  4. Host and edge (HTTPS, quality host, firewall)
  5. Detection and recovery (scans, events, backups you can restore)

Most compromises still start with outdated plugins or weak admin access. Start there even if you never touch Apache configs.

1. Keep software current

  • Update WordPress core promptly, especially security releases
  • Update plugins and themes on a schedule
  • Delete unused plugins and themes (deactivated is not deleted)
  • Keep PHP on a supported version your host recommends

Use staging for fragile sites. Auto-update trusted plugins when you can. After bigger updates, re-run security tests and a vulnerability scan.

2. Harden wp-config.php

Generate fresh WordPress salts/keys after a compromise, or when you inherit a site.

On production:

define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );

Stop theme/plugin file editing from wp-admin (worth doing on almost every live site):

define( 'DISALLOW_FILE_EDIT', true );

Only use DISALLOW_FILE_MODS if you intentionally manage updates outside wp-admin. It blocks plugin/theme installs and updates from the dashboard.

A custom table prefix helps a little against dumb automated scripts. It is not a substitute for updates and strong logins. Changing prefix on a live site needs care; do it on new installs when you can.

3. File permissions and wp-config protection

Exact values depend on the host, but a common baseline is:

  • Directories: 755
  • Files: 644
  • wp-config.php: tighter when possible (600 or 640)

Avoid 777. If the site breaks after tightening permissions, ask the host what their WordPress stack expects instead of opening everything up.

On Apache, you can also deny web access to wp-config.php in .htaccess. Change one rule at a time, test the homepage and /wp-admin/, and keep a backup of the file. Full snippets and rollback notes: .htaccess security guide.

Core Scanner helps spot unexpected changes to WordPress core files after hardening.

4. Strong passwords, limited logins, 2FA

Strong password guidance

  • Unique long passwords in a password manager (not dictionary words, not reused across sites)
  • No shared “team admin” account
  • Few administrators; everyone else gets the lowest role that works
  • Two-factor authentication for admins
  • Limit failed logins and consider renaming the login URL via login protection

Rename alone is not enough. Combine it with rate limiting and 2FA. More depth: login security guide.

5. Plugins, themes, and unused software

  • Prefer WordPress.org or known commercial vendors
  • Check last update date before install
  • Never use nulled “premium” packages
  • Remove abandoned plugins you cannot replace soon
  • Delete unused themes too (default themes you do not need still count)

Scan installed software for known issues with the vulnerability scanner (included free). Deeper plugin hygiene: plugin security risks.

6. HTTPS, host, and edge protection

  • Force HTTPS site-wide (most hosts include a free certificate; turn on the redirect)
  • Pick a host with working backups, support, and a reputation for keeping the stack patched
  • Put a WordPress firewall plugin or Cloud Firewall in front of WordPress to cut exploit and brute-force noise (Pro: 600M+ bad IPs, country/custom rules)
  • Keep the server/PHP stack updated (your host usually owns this on managed plans)

Server deep-dives (custom TLS ciphers, DB privilege surgery, Apache module surgery) help when you control the VPS. On shared or managed WordPress hosting, spend your time on updates, logins, firewall, and backups first.

Security headers (nice, not magic)

If your host or a security plugin can set headers, useful ones include:

  • Strict-Transport-Security (HSTS) after HTTPS is solid
  • X-Content-Type-Options: nosniff
  • Referrer-Policy with a sensible default
  • Content-Security-Policy only if you can maintain it (easy to break the site)

Headers help browsers behave better. They do not replace patching plugins.

Database habits worth doing

  • Strong unique DB password (host panel usually sets this)
  • Do not share the DB user across unrelated apps
  • Avoid granting exotic privileges the site does not need
  • After a compromise, assume the DB may contain junk users, options, or injected content; restore or clean carefully

7. XML-RPC: caution, not a default kill switch

XML-RPC helps some mobile apps, Jetpack-related flows, and remote tools. It is also a common brute-force and pingback abuse path.

  • If nothing you use needs it, blocking or disabling it is reasonable
  • If something breaks after you block it, reverse the change
  • Prefer firewall rate limits and strong auth over disabling features you still use

On Apache, add rules one at a time and test. Details and safer patterns: .htaccess guide.

8. Detect problems early

Hardening without monitoring still fails quietly.

  • Run malware scans on a schedule (Pro)
  • Watch the events log for odd logins, blocks, and changes
  • Turn on alerts (email/webhooks) for things that matter
  • Check Search Console if traffic or warnings look wrong
  • Re-run security tests after bigger changes so regressions do not sit unnoticed

Scheduled scans matter because most site owners do not open the dashboard every day. Set the schedule, then check failures.

9. Backups you can restore

Hardening reduces risk. Backups limit damage.

  • Automatic backups of files and database
  • Off-site copies when possible
  • Retention long enough to go back before an infection started
  • One restore test so you know the process

Details: backup plan after an attack.

Store backup credentials outside the site. If malware can read your wp-admin, you do not want the only restore path living in the same compromise.

10. A security plugin that matches the job

A good security plugin should help you enforce and verify hardening, not replace updates and strong logins.

A WordPress security plugin like Security Ninja covers security tests, vulnerability checks, and core integrity free. Pro adds Cloud Firewall (600M+), malware scanner, scheduled scans, login protection, and 2FA. The install wizard turns on sensible defaults so you are not guessing which toggles matter first. Avoid stacking three overlapping security plugins; they fight each other. See plugin conflicts and best WordPress security plugins if you are still choosing.

A practical rollout order

Day 1

  1. Backups confirmed
  2. Update everything; delete unused plugins/themes
  3. Fix admin accounts, passwords, 2FA
  4. Enable login protection + firewall if you have Pro

This week

  1. DISALLOW_FILE_EDIT, debug off on production
  2. Permission check; protect wp-config access if Apache allows it
  3. Vulnerability + malware scan; fix what you find
  4. Security tests / hardening checklist in Security Ninja
  5. Decide on XML-RPC only after you know what uses it

Ongoing

  1. Monthly update + admin review (habits live in best practices)
  2. Scheduled scans and backup success checks

Next steps

If the site is already compromised

Do not “harden” over active malware and call it done. If you are unsure, tell if your WordPress site has been hacked first. Remove WordPress malware or restore, then harden so they do not walk back in. Guide: WordPress site hacked. Need help? Hire cleanup or a review.

Found this useful? Share it.

Frequently asked questions

What is WordPress hardening? +

WordPress hardening means closing the doors attackers use most: outdated software, weak logins, loose file permissions, exposed configuration and unused plugins. It is a set of settings and habits, not a single plugin. Done in the right order, it removes most easy attack paths on a typical site in an afternoon.

How do I harden WordPress? +

Start with updates, then lock down wp-config.php and file permissions, add strong passwords, login limits and 2FA, remove unused plugins and themes, use HTTPS, and keep tested backups. Our checklist above lists all ten steps in the order we recommend, with the time each one takes.

Is there an official WordPress hardening guide? +

Yes. WordPress.org publishes a Hardening WordPress page in its advanced administration handbook. Our guide follows the same principles and adds a practical order, time estimates and what to check after each step. Read both: theirs explains the why, ours helps you finish the work.

Does hardening replace a security plugin? +

No. Hardening closes doors. A security plugin watches them and tells you when something changes, such as a new vulnerability in a plugin you use, a failed login spike or a modified core file. Most sites need both, and the free version of Security Ninja checks many of the hardening steps for you.

Can WordPress hardening break my site? +

Some steps can, especially file permissions, disabling XML-RPC and strict security headers. Change one thing at a time, test the front end and wp-admin, and keep a recent backup. If something breaks, undo the last change first. That is why our checklist goes from safest to most invasive.

How long does it take to harden WordPress? +

About two to three hours the first time on a typical site, then a few minutes a week to keep updates and checks current. Agencies can save time by exporting settings from one site and importing them on the next.

How do you secure a WordPress website? +

Update core, plugins, and themes weekly. Lock down wp-config.php and file permissions. Use strong passwords, login limits, and 2FA on every role that can change the site. Remove unused themes and plugins from disk, force HTTPS, restrict XML-RPC if you do not need it, run malware and vulnerability scans, keep backups you have restored once, and use a security plugin you will open regularly. The numbered list at the top of this page is the order we use.

Larger screenshot

Enlarged image