WordPress Security: A Hardening Checklist for Your Site
WordPress security checklist: updates, strong logins and 2FA, file permissions, wp-config.php, no PHP in uploads, XML-RPC, firewalls and tested backups.

Contents
- Where WordPress sites actually get hacked
- Keep core, plugins and themes updated
- Remove what you don't use, install only from trusted sources
- Protect the accounts
- HTTPS everywhere and a supported PHP version
- Harden wp-config.php and file permissions
- Block PHP in the uploads folder
- XML-RPC: what it is and when to turn it off
- What doesn't help much
- Security plugins and firewalls
- Backups, security keys and monitoring
- The checklist at a glance
- WordPress security at Nodesty
WordPress security is mostly routine work, not secret tricks: most hacked WordPress sites were running an outdated plugin, a weak or reused password or a "free" copy of a paid theme. WordPress core itself is patched quickly, and a site that stays updated, runs few plugins and protects its logins is a hard target for the bots that scan the web all day.
This guide covers where WordPress sites actually get compromised, then a practical checklist: updates, plugins and themes, accounts and two-factor authentication, HTTPS and PHP, wp-config.php and file permissions, PHP in the uploads folder, XML-RPC, security plugins and firewalls, backups and monitoring. If your site is already hacked, start with our Website hacked: what to do guide instead.
Where WordPress sites actually get hacked
Attacks on WordPress are rarely aimed at you personally. Bots scan millions of sites for the same few weaknesses:
- Outdated or abandoned plugins and themes. By far the most common way in. Once a vulnerability is published, bots start probing for it soon after, and a plugin its developer has abandoned never gets the fix.
- Weak or reused passwords. Bots try leaked email and password pairs and common passwords against
wp-login.phparound the clock. - Nulled themes and plugins. Cracked copies of paid software often ship with a backdoor built in, and they never receive updates.
- Everything around WordPress. A stolen hosting panel or FTP password, an infected computer or a neglected second site in the same account leads to the same result.
Keep core, plugins and themes updated
Updates are the single most effective measure. WordPress installs minor core releases (security and maintenance) automatically by default. For everything else:
- Under Dashboard → Updates, install pending updates and choose whether core should also move to new major versions by itself.
- Under Plugins, click Enable auto-updates for the plugins you trust to update themselves; themes have the same link in their details view under Appearance → Themes.
- For a shop or a site with many plugins, try major updates on a copy first; our staging environment guide shows how. Security releases shouldn't wait long either way.
With SSH and WP-CLI:
cd ~/public_html
wp core update
wp plugin update --all
wp theme update --all
wp plugin auto-updates enable --all
If an update breaks the site, our WordPress critical error guide shows how to find and disable the faulty plugin.
Remove what you don't use, install only from trusted sources
A deactivated plugin is still on the disk, and its vulnerable files can often be called directly by URL. Delete plugins and themes you don't use; keep only the active theme and one default theme as a fallback.
wp plugin list --status=inactive
wp plugin delete old-slider
wp theme delete old-theme
Install plugins and themes only from the wordpress.org directory or directly from the developer. Before installing, look at the last update date and the "Tested up to" version; replace a plugin that hasn't been updated in years or has been closed in the directory. Never use nulled copies: what you save is small next to the cost of a cleanup.
Protect the accounts
- Strong, unique passwords. Use a password manager and a long random password for every administrator, and never reuse it for the hosting panel, FTP or the database.
- No
adminusername. It is the first name bots try. WordPress can't rename a user: create a new administrator, log in with it, delete the old account and assign its content to the new one. Usernames can often be found out anyway, so treat this as a small extra. - Two-factor authentication. WordPress core has no 2FA, so add it with a plugin; many security plugins include it. Require it for every administrator and editor. Our What is 2FA? guide explains how the codes work.
- Limit login attempts. By default WordPress accepts unlimited password guesses. A login limiting plugin, a security plugin or the host's firewall blocks an IP address after a few failed attempts.
- Least privilege. Give each person the lowest role that works: Editor, Author or Contributor instead of Administrator. Under Settings → General, leave Anyone can register off unless you need it, keep the default role at Subscriber and delete the accounts of people who have left.
If you lock yourself out along the way, see How to reset the WordPress admin password.
HTTPS everywhere and a supported PHP version
Without HTTPS, passwords and login cookies travel in plain text. Install a certificate (a free one is enough; see What is an SSL certificate?), set both addresses under Settings → General to https:// and redirect HTTP to HTTPS. Headers such as HSTS add another layer; they are covered in our HTTP security headers guide.
PHP versions reach end of life too. At the time of writing, PHP 8.1 and older no longer receive security fixes from the PHP project. Tools → Site Health warns about an outdated version, and our How to change PHP version guide shows the switch in cPanel and DirectAdmin. Test old plugins on staging first.
Harden wp-config.php and file permissions
The built-in theme and plugin file editors let anyone with an administrator session write PHP straight to the server. Turn them off with this line in wp-config.php, above /* That's all, stop editing! */, and make sure WP_DEBUG is false on a live site:
define( 'DISALLOW_FILE_EDIT', true );
Then set sane permissions: 644 for files, 755 for directories and 600 for wp-config.php, which holds the database password and the security keys:
cd ~/public_html
find . -mindepth 1 -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 600 wp-config.php
On shared hosting PHP usually runs as your own account user, so 600 works. On a VPS where PHP runs as www-data and the files belong to another user, use 640 with www-data as the group. Never use 777 anywhere, not even "temporarily". The background is in our Linux file permissions guide.
Block PHP in the uploads folder
wp-content/uploads should contain only media, yet it is where attackers most often drop a PHP backdoor, because WordPress must be able to write there. Stop the web server from running PHP in it. On Apache and LiteSpeed, add this to the .htaccess file in the site's root folder, above the # BEGIN WordPress line:
RewriteEngine On
RewriteRule ^wp-content/uploads/.*\.(php[0-9]?|phtml|phar)$ - [F,NC]
On Nginx, put this in the site's server block before the location ~ \.php$ block, then run sudo nginx -t && sudo systemctl reload nginx:
location ~* ^/wp-content/uploads/.*\.(php[0-9]?|phtml|phar)$ {
deny all;
}
Check the result: images must still load, and a test file such as wp-content/uploads/test.php must return 403 Forbidden.
XML-RPC: what it is and when to turn it off
xmlrpc.php is WordPress's older remote interface. Jetpack, the WordPress mobile app on some setups and a few external publishing tools use it; most other sites don't need it, because the REST API has taken over. For attackers it is a second login door that protections on the login page, such as a CAPTCHA or a changed login address, don't cover, and its pingback feature can be abused to make your site send requests to other sites.
If nothing on your site uses it, block the file. On Apache and LiteSpeed, add one more line below the rule above:
RewriteRule ^xmlrpc\.php$ - [F]
On Nginx:
location = /xmlrpc.php {
deny all;
}
If Jetpack or the mobile app stops working afterwards, remove the rule and rely on login limiting and 2FA instead.
What doesn't help much
- Hiding or changing the login URL is obscurity, not security. It cuts down bot noise on
wp-login.php, but it doesn't fix a weak password or a vulnerable plugin. Use it if you like, never instead of 2FA and login limits. - Changing the
wp_table prefix is low-value: an attacker who can run SQL through an injection hole can simply read the table names, and changing the prefix on a live site risks breaking it. - Hiding the WordPress version hardly matters: bots fire their exploits without checking the version, and it can be worked out from the site's files anyway.
Security plugins and firewalls
A security plugin such as Wordfence bundles several items from this list: login limiting, 2FA, a scan for changed or malicious files and a firewall that runs inside WordPress. A web application firewall in front of the site, for example Cloudflare, or server-side protection from your host filters many malicious requests before they reach WordPress at all. Both are an extra layer that catches part of the attacks; neither replaces updates, strong logins and backups. One security plugin is enough: several at once overlap and slow the site down.
Backups, security keys and monitoring
- Off-site backups. Back up the files and the database automatically, keep copies outside the hosting account and several days back, because a hack is often noticed late. Restore a backup to a staging copy now and then; an untested backup is only a hope. Details are in our Server backups guide.
- New security keys after an incident. If you suspect someone got in, replace the eight keys and salts in
wp-config.phpwith fresh ones fromhttps://api.wordpress.org/secret-key/1.1/salt/or runwp config shuffle-salts. Every session is logged out; passwords stay the same, so change those separately. - Monitoring. Check Tools → Site Health from time to time and keep the administration email under Settings → General current: WordPress sends notices about new users, automatic updates and errors there. Review the administrators and the core files regularly:
wp user list --role=administrator
wp core verify-checksums
wp plugin verify-checksums --all
The plugin check only covers plugins from wordpress.org. An administrator you don't know or changed files you never touched are warning signs.
The checklist at a glance
| Measure | Effort | Effect |
|---|---|---|
| Updates and auto-updates | Low | Very high |
| Delete unused plugins and themes | Low | High |
| Trusted sources only, nothing nulled | Low | Very high |
| Strong unique passwords and 2FA | Low | Very high |
| Login limiting and least-privilege roles | Low | Medium |
| HTTPS and a supported PHP version | Low | High |
DISALLOW_FILE_EDIT and file permissions | Low | Medium |
| No PHP in uploads, XML-RPC blocked | Low | Medium, limits the damage |
| Security plugin or firewall | Medium | Medium, an extra layer |
| Off-site backups with a tested restore | Medium | Very high, for the recovery |
| Hidden login URL, table prefix, version info | Low | Low |
WordPress security at Nodesty
Nodesty web hosting runs WordPress sites on AMD Ryzen 9 7900 servers with the LiteSpeed web server and NVMe storage, managed with cPanel or DirectAdmin. Free SSL covers HTTPS, you choose a supported PHP version in the panel, Imunify360 protects against malware and attacks on the server side, and JetBackup gives you your backups in the panel. LiteSpeed reads .htaccess files, so the rules in this guide work there as written. If you'd rather manage the whole server yourself, our AMD Ryzen 9 9950X VPS plans give you full root access and free daily backups kept for 7 days. A fresh installation is covered in our How to install WordPress guide.
Frequently Asked Questions
Is WordPress secure?
WordPress core is maintained by a security team and holes are usually fixed quickly. Most hacked sites were not broken through core but through an outdated plugin or theme, a weak or reused password or a nulled copy of paid software. A site that stays updated, runs few plugins and protects its logins is a hard target.
Do I need a security plugin?
Not strictly, but it helps. A security plugin bundles login limiting, two-factor authentication, a file scan and a firewall in one place. It is an extra layer, not a replacement for updates, strong passwords and backups. Install one, not several, because they overlap and get in each other's way.
Does hiding the login page make my site secure?
No. A changed login address is obscurity, not security. It reduces the noise bots make on wp-login.php, but it does not fix a weak password or a vulnerable plugin. Strong unique passwords, two-factor authentication and a limit on login attempts are what protect the login.
Should I disable XML-RPC?
If nothing on your site uses it, yes. Jetpack, the WordPress mobile app on some setups and a few external publishing tools depend on xmlrpc.php; most other sites do not need it. Block the file at the web server and remove the rule again if one of those tools stops working.
Which file permissions should WordPress have?
Files 644, directories 755 and wp-config.php 600, or 640 when the web server runs as a different user that reaches the file through its group. Never set 777 anywhere, not even temporarily, because it lets every user on the server write to your files.
Are automatic updates safe?
Minor core releases install automatically by default and very rarely cause trouble. Automatic plugin and theme updates can occasionally break something, which is why you need backups and, for larger sites, a staging copy for major updates. For most sites the risk of running outdated code is far greater than the risk of an update.
About the author
Nodesty Team · Infrastructure & Support
The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.
Related articles

How to Install Let's Encrypt SSL with Certbot (Nginx and Apache)
How to install Let's Encrypt SSL with Certbot on a Linux server: Nginx and Apache setup, automatic renewal, wildcard certificates and common errors.

How to Set Up SSH Keys and Disable Password Login
How to set up SSH keys: create an ed25519 key with ssh-keygen, copy it to your Linux server, test the login and safely turn off password login.

How to Add a User on Linux and Give Sudo Rights
Add a user on Linux with adduser or useradd, give sudo rights, copy your SSH key, turn off root login, and lock, expire or delete users safely.