To secure a WordPress website, keep core, plugins, themes and PHP updated, use unique admin passwords with two-factor authentication, limit login attempts, disable dashboard file editing, set file permissions to 755 for directories and 644 for files, disable XML-RPC if unused, enforce HTTPS, add a firewall, and keep tested off-site backups. Most vulnerabilities are in plugins, so audit and delete what you do not use.
Key takeaways
- 91% of WordPress ecosystem vulnerabilities in 2025 were in plugins, and core had only six low-priority flaws.
- Updates, unique admin credentials with 2FA, and login limits stop the most common attacks.
- A backup you have never restored is a hypothesis — test a full restore before you need it.
WordPress powers about 40% of all websites, which makes it the biggest target on the web — and the most attacked. The good news is that most hacks do not come through WordPress itself. They come through the doors site owners leave open: outdated plugins, weak admin passwords and backups nobody has tested.
Why is WordPress targeted so often?
WordPress is targeted because it is everywhere, and because attackers can automate the work. A bot can scan thousands of sites for a known plugin flaw or try common admin passwords, and it only needs one success to pay off.
The numbers show where the risk sits. Patchstack logged 11,334 new vulnerabilities in the WordPress ecosystem in 2025, up 42% on the year before, and 91% of them were in plugins, with 9% in themes. WordPress core had only six reported vulnerabilities, all low priority. That means your plugin list matters far more than your WordPress version alone.
The same figures appear in the 2026 WordPress statistics roundup, which also puts WordPress at about 40% of all websites in October 2026 — a large target, and a large reason to keep it patched.
WordPress itself puts it plainly in its hardening handbook: security is risk reduction, not risk elimination. The goal is layered, boring controls that close the easy doors and contain the damage when something fails. See the official Hardening WordPress handbook for the source guidance behind this article.
What should you do before you start hardening?
Take a full backup of files and database before you change anything, and make sure you know how to restore it. Several hardening steps can break a plugin that relies on what you switch off, so you need a way back.
Use a staging copy if you have one. Test changes there first, especially blocking XML-RPC, stopping PHP execution in uploads, and adding a Content Security Policy. Work top to bottom through the checklist below, and stop and restore if a step fails before you stack the next control on top of it.
How do you keep WordPress updated?
Keep WordPress core, plugins, themes and PHP updated, and treat plugin updates with the same urgency as core updates. Most security releases fix flaws that are already public, so an out-of-date plugin is a documented way in that anyone can look up.
Minor WordPress releases update automatically by default; leave that on. Turn on automatic updates for plugins you trust, and test major updates on staging before they go live. Check for updates every week, and check Tools, then Site Health, for pending PHP and plugin warnings.
Delete plugins and themes you do not use. Deactivated is not enough — delete them, because deactivated code can still be exploited. Never run nulled plugins or themes from untrusted sources: the WordPress handbook warns that they are a common source of backdoors. Run PHP 8.2 or newer, on a version still receiving security fixes, since PHP 8.1 reached end of life in December 2025.
How do you secure WordPress logins?
Use a strong unique password from a password manager for every account, plus two-factor authentication on every account that can publish content or change settings. WordPress core does not ship 2FA, so add a maintained plugin — the Two Factor plugin maintained by core contributors is a solid free choice.
Avoid usernames such as admin or webmaster. If your primary account is literally called admin, create a new administrator with a different username, log in as it, and delete the old one, reassigning content to the new user. Give each user the lowest role that lets them do their job, and audit administrator accounts regularly.
Limit login attempts to blunt brute-force and credential-stuffing attacks. Use a rate limiter such as Limit Login Attempts Reloaded, or the login protection built into your firewall plugin, and rate-limit wp-login.php at the edge through your host or CDN WAF when you can. Generate a strong admin password with our free password generator if you have not already.
How do you harden wp-config.php and files?
Disable file editing in the dashboard by adding define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php, above the line that reads That is all, stop editing. If an attacker reaches an administrator session, the built-in editor turns that into remote code execution in seconds.
Regenerate your salts while you are in the file. Visit the WordPress secret-key service, paste the eight new lines over the old ones, and save — this invalidates every logged-in session at once. Add define( 'FORCE_SSL_ADMIN', true ); to force SSL on admin and login screens.
Set file permissions correctly: directories 755, files 644, and wp-config.php tighter at 640 or 600 if your host allows it. All files should be writable only by your user account, except where WordPress genuinely needs write access. Stop PHP from running in the uploads folder, so an uploaded file cannot execute as code — this single change turns most file-upload flaws from site takeover into a useless file on disk.
How do you secure the server and HTTPS?
Serve every page over HTTPS and redirect plain HTTP to it. Send a Strict-Transport-Security header so browsers stop trying the insecure version, and add the other security headers your site needs — X-Content-Type-Options, X-Frame-Options and Referrer-Policy at minimum.
A Content Security Policy is the strongest header and the hardest one to get right, so test it on staging and watch for blocked resources before enforcing it. Keep errors off the page: display_errors should be off in production, with errors logged to a file instead, so attackers cannot read paths and versions from error messages.
Choose a host that provides recent stable server software, reliable backups and recovery, and clear answers about its security processes. On shared hosting, a compromised neighbor can affect your site, so ask your host what isolation it provides.
Verify your setup with our free SSL checker.
Then check the headers your server sends with our free security headers checker.
Should you disable XML-RPC?
Turn off XML-RPC if nothing uses it. The xmlrpc.php endpoint is a classic target for brute-force amplification and pingback abuse, and most sites do not need it at all. The exceptions are Jetpack and the WordPress mobile app, which rely on it.
Test before you disable it: if Jetpack, the mobile app or a specific plugin needs XML-RPC, blocking it will break that feature. In that case, restrict access to the endpoint instead — limit it to the IPs that need it, or rate-limit it hard at the edge. Do not rely on hiding it as your main defense.
Do you need a firewall and monitoring?
Add a firewall and a scanner, but pick one maintained plugin and configure it properly. A web application firewall blocks known exploit patterns before they reach WordPress, and a scanner watches for changed files, new admin users and unknown plugins.
Monitor continuously: unexpected file changes, new admin users, and outbound connections are the earliest signs of a compromise. Hook vulnerability monitoring to a channel a human actually reads, so a new flaw in a plugin you use reaches you the same day, not the same month.
Do not run two security plugins that overlap, and do not assume a firewall replaces updates. A WAF buys time; it does not fix the vulnerable plugin underneath it. For a wider baseline, our small business cybersecurity checklist covers firewalls alongside backups and access control.
How should you back up WordPress?
Keep tested, off-site backups, with at least one copy somewhere the WordPress server has no credentials for. If an attacker compromises the server, a backup stored on the same server — or reachable with the same credentials — is not a backup.
Back up both files and the database, on a schedule that matches how often your content changes. A backup you have never restored is a hypothesis: test a full restore to a scratch environment every quarter, and document the steps so someone else can do it under pressure.
Keep several restore points, not just the latest one. If a compromise went unnoticed for weeks, the most recent backup may already contain the backdoor. Knowing which backup is clean matters as much as having one.
What is the full 20-step checklist?
Use this list as a one-sitting pass, or stage it over a weekend. Each step ends with a quick check: verify the site still works before moving on.
| Step | Action | Verify |
|---|---|---|
| 1 | Update core, plugins, themes, PHP | Dashboard shows no pending updates |
| 2 | Delete unused plugins and themes | Plugins list has no unused entries |
| 3 | Install only from trusted sources | No nulled or unknown plugins |
| 4 | Unique passwords, 2FA for admins | Every admin has 2FA on |
| 5 | Limit login attempts | Failed logins are throttled |
| 6 | Remove the admin username | No user named admin exists |
| 7 | Least privilege for all roles | Admin count is justified |
| 8 | Disable dashboard file editing | Editor menu is gone |
| 9 | Regenerate salts | All sessions signed out |
| 10 | File permissions 755 and 644 | wp-config.php is 640 or tighter |
| 11 | Block PHP in uploads | Test upload cannot execute |
| 12 | Errors off the page | No errors shown to visitors |
| 13 | HTTPS everywhere with HSTS | SSL checker passes |
| 14 | Security headers set | Headers checker passes |
| 15 | Disable XML-RPC if unused | xmlrpc.php returns an error |
| 16 | Firewall and scanner active | Scan finds no issues |
| 17 | Off-site backups running | Restore tested this quarter |
| 18 | Monitor file changes | Alerts reach a human |
| 19 | Separate databases per site | One breach cannot spread |
| 20 | Staging not publicly indexed | Staging is password protected |
What should you do if your WordPress site was hacked?
Do not harden a compromised site and hope for the best. Restore from a known-clean backup, or rebuild from clean core and plugin files, then change every password and salt. Hardening after a clean restore is the right order.
- Take the site offline or into maintenance mode to stop visitors reaching malicious content.
- Restore from a clean backup, or reinstall core and plugins from official sources and remove unknown files.
- Change all passwords and salts, including hosting, database and admin accounts, from a clean device.
- Scan for backdoors with a security plugin and compare files against clean copies of the same versions.
- Find the entry point — usually an outdated plugin or a weak password — and fix it before going live.
What mistakes should you avoid?
The most common mistake is spending money on a premium security plugin while leaving an outdated plugin installed and the admin password as a pet's name. Tooling cannot compensate for the basics, and the basics are mostly free.
- Trusting obscurity. Hiding wp-login.php or renaming folders does not stop a determined attacker.
- Keeping deactivated plugins. Deactivated code can still be exploited, so delete it.
- Skipping the restore test. An untested backup is a guess, not a recovery plan.
- Sharing admin accounts. Give everyone their own account so access can be revoked per person.
- Ignoring PHP. An updated WordPress on an end-of-life PHP version is still exposed.
The bottom line
Securing WordPress is mostly configuration, not expensive tooling. Update everything, delete what you do not use, lock down logins with 2FA, fix file permissions, and keep a backup you have actually restored.
Start with the first two steps today — updates and admin logins — then work through the checklist. You can verify the result with the free SSL checker.
For a second check, run the free security headers checker to confirm HSTS and the other headers are present.
Frequently asked questions
How do I secure my WordPress website for free?
Update everything, delete unused plugins and themes, use a strong unique admin password with free two-factor authentication, limit login attempts, disable dashboard file editing, and keep free off-site backups. These cost nothing and stop most attacks.
Is WordPress secure?
WordPress core is well maintained: only six vulnerabilities were reported in core in 2025, all low priority. Most risk comes from plugins, themes, weak passwords and outdated PHP, which are all under the site owner's control.
Do I need a WordPress security plugin?
A firewall and scanner plugin helps, but it is not a substitute for updates, strong logins and backups. Pick one maintained plugin, configure it properly, and do not run two security plugins that fight each other.
Should I hide wp-login.php?
Hiding the login page is optional noise reduction, not a security plan. Attackers can find it anyway. Spend the effort on two-factor authentication, login rate limiting and a strong password instead.
How often should I update WordPress plugins?
Check weekly, and apply security updates as soon as they appear. Minor WordPress releases update automatically by default; leave that on. Test major updates on staging first if your site is complex.
What file permissions should WordPress use?
Directories should be 755 and files 644, with wp-config.php tighter at 640 or 600 where your host allows it. Files should be writable only by your user account, not by the web server, except where WordPress genuinely needs it.
How do I know if my WordPress site was hacked?
Look for new admin users, unknown plugins, changed files, unexpected redirects, spam pages in search results, and warnings from Google Search Console. Scan with a security plugin and compare files against a clean copy of the same versions.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the official WordPress Hardening handbook and Patchstack's State of WordPress Security in 2026 report.
How we write and fact-check →