Securing WordPress
Practical WordPress security: login hardening, malware scanning, and more. No plugins-only advice.
3 min read
WordPress runs more than 40% of all websites, so it’s the CMS bots target most. GoZen WordPress hosting includes a server-level web application firewall and malware scanning (Imunify360 or cPGuard, depending on the server), but application-level security is up to you. Most attacks are automated: bots try default usernames, known plugin vulnerabilities and weak passwords. The steps below block most of them.

The Basics (Do These First)
1. Keep Everything Updated
Outdated plugins and themes are the most common way in.
- Core: keep auto-updates on for minor releases (on by default since WordPress 3.7)
- Plugins: enable auto-updates for all plugins: Plugins → check the plugin → Enable auto-updates
- Themes: delete any themes you’re not using. Keep only your active theme and one default theme (like Twenty Twenty-Five)
2. Use Strong Credentials
| Don’t | Do |
|---|---|
Username: admin | A unique username (your first name, a nickname) |
Password: password123 | 16+ character password from a password manager |
| Same password everywhere | Unique password per site |
If you’re still using admin as your username, create a new admin user with a different name, log in as the new user, and delete admin.
3. Enable Two-Factor Authentication
Install Two-Factor (free, lightweight) or Wordfence (includes 2FA plus more).
See Enabling Two-Factor Authentication for details.
File-Level Hardening
Protect wp-config.php
Move it one level up (WordPress looks there automatically):
mv /home/username/public_html/wp-config.php /home/username/wp-config.php
Or block access via .htaccess:
<Files wp-config.php>
Require all denied
</Files>
Disable File Editing
WordPress has a built-in file editor that lets anyone with admin access edit theme and plugin files. Disable it:
// Add to wp-config.php
define('DISALLOW_FILE_EDIT', true);
Prevent PHP Execution in Uploads
Attackers often upload malicious PHP files disguised as images. Block PHP execution in the uploads folder:
Create /wp-content/uploads/.htaccess:
<Files "*.php">
Require all denied
</Files>
Login Hardening
Limit Login Attempts
Install Limit Login Attempts Reloaded (free) or use Wordfence. It blocks IPs after repeated failed logins, much like Fail2Ban does for SSH.
Change the Login URL
Bots probe the default /wp-admin and /wp-login.php URLs constantly. Change them with WPS Hide Login:
- Install and activate WPS Hide Login
- Go to Settings → WPS Hide Login
- Set a custom URL (e.g.,
/my-login)
Write down your custom login URL. If you forget it, you’ll need to disable the plugin via FTP or File Manager to get back in.
Disable XML-RPC
XML-RPC is an older API that most sites don’t need, and it’s often used for brute-force attacks. Disable it unless a service you use (such as the Jetpack app) depends on it:
# Add to .htaccess
<Files xmlrpc.php>
Require all denied
</Files>
Security Plugins
Install only one security plugin; running two usually causes conflicts.
| Plugin | Best For | Free Tier |
|---|---|---|
| Wordfence | All-in-one (firewall + scanner + 2FA) | Yes (strong) |
| Solid Security | Hardening checklists | Yes |
| Sucuri Security | Malware scanning and cleanup | Yes (scanner only) |
Security Checklist
After setting up your WordPress site, run through this:
- WordPress, plugins, and themes all updated
- auto-updates enabled for plugins
-
adminusername changed - Strong password (16+ characters)
- Two-factor authentication enabled
-
wp-config.phpprotected - File editing disabled (
DISALLOW_FILE_EDIT) - PHP execution blocked in
/uploads/ - Login attempts limited
- XML-RPC disabled
- Unused plugins and themes deleted
- SSL active (HTTPS)
- A security plugin installed and configured
What to Do Next
- GoZen Security Scanner - run an external security audit on your WordPress site
- Using cPGuard: server-level protection included with your GoZen plan
- Backups and Restores: make sure you have a recovery plan
- Server Hardening Basics: if you’re on a VPS, secure the server too
Last updated 21 Oct 2026, 00:00 +0300.