How to Secure a WordPress Site in 2026: 12-Step Checklist + Server Hardening
Want a hosting that protects WordPress at the server level?
CloudLinux isolation, ModSecurity WAF, CPGuard and free SSL on every plan.
Summary: In this complete guide, you will learn how to secure a WordPress site with 12 actionable steps, from plugin configuration and 2FA to server-level hardening with CloudLinux isolation, ModSecurity WAF, and CPGuard. Most guides stop at Wordfence. This one covers the infrastructure layer that plugins alone cannot protect.
Quick Summary
- Biggest risk: outdated plugins account for over 90% of WordPress hacks
- Essential plugin: Wordfence free tier covers firewalling, malware scanning and 2FA
- Most overlooked step: server-level protection (CloudLinux, ModSecurity WAF) that Wordfence cannot replace
- Quick wins: disable XML-RPC, harden wp-config.php, enforce correct file permissions
- Non-negotiables: HTTPS, daily off-site backups and 2FA on all admin accounts
Step 1: Understand Why WordPress Is a Constant Target
WordPress powers over 43% of all websites on the internet, which makes it the most targeted CMS for automated attacks. Bots continuously scan for outdated plugins, weak credentials, and misconfigured servers.
- Brute force attacks attempt thousands of login combinations per minute
- Plugin vulnerabilities account for over 90% of WordPress hacks
- Shared hosting without isolation allows cross-account contamination
- GDPR and data protection regulations require active security measures
Security is not optional. It is part of your website infrastructure.
The first line of defense starts at the server level. Choosing WordPress hosting with CloudLinux account isolation means that even if another account on the same server is compromised, yours stays protected.
Step 2: Keep WordPress Core, Themes, and Plugins Updated
Every WordPress update patches known security vulnerabilities. Leaving your installation outdated is the most common reason sites get hacked.
- Enable automatic minor updates for WordPress core
- Update plugins and themes immediately when patches are released
- Remove unused, deactivated, or abandoned plugins entirely
- Avoid plugins with no updates in the last 12 months
- Use the WPScan vulnerability database to check your plugins
Outdated plugins are the leading cause of WordPress compromises.
Step 3: Wordfence Setup: Step-by-Step Configuration
Wordfence is the most widely used WordPress security plugin, with over 5 million active installations. It provides a full security suite directly inside your WordPress dashboard.
What Wordfence Does
- Web Application Firewall (WAF): blocks malicious traffic before it reaches WordPress
- Malware scanner: checks core files, themes, and plugins against known threats
- Brute force protection: limits login attempts and blocks repeated failures automatically
- Live traffic monitoring: shows real-time bot and human traffic on your site
- Two-factor authentication (2FA): adds a second verification step to the login
- IP blocking and country blocking: allows granular traffic filtering
Wordfence Setup: Recommended Configuration
- Install Wordfence from the WordPress plugin repository
- Run the initial scan immediately after activation
- Set the firewall to Extended Protection mode (requires editing .htaccess)
- Enable email alerts for new admin users, failed logins, and plugin changes
- Schedule automatic weekly scans
- Enable rate limiting to block crawlers and scrapers
CPGuard malware scanner, CloudLinux isolation, ModSecurity WAF and free SSL included on all plans.
Step 4: Secure Your WordPress Admin Login
The /wp-admin and /wp-login.php URLs are the primary targets of automated attacks. Hardening access to your dashboard is one of the highest-impact changes you can make.
- Change the default "admin" username: it is the first credential bots try
- Use a strong, unique password: minimum 16 characters with symbols
- Enable two-factor authentication (2FA) via Wordfence or Google Authenticator
- Limit login attempts: lock out IPs after 3 to 5 failed attempts
- Change the login URL: use a plugin like WPS Hide Login to move /wp-login.php
- Restrict /wp-admin by IP: add IP whitelisting in .htaccess if your IP is static
- Disable user enumeration: prevents bots from discovering usernames via ?author=1
Weak admin credentials are the second most common WordPress attack vector after outdated plugins.
Step 5: WordPress Hardening: wp-config.php, File Permissions, and XML-RPC
Protect wp-config.php
The wp-config.php file contains your database credentials and secret keys.
Add this rule to your .htaccess to block direct HTTP access:
<files wp-config.php> order allow,deny deny from all </files>
Correct File Permissions
- Directories: 755
- Files: 644
- wp-config.php: 440 or 400
Never set files to 777: this grants write access to everyone on the server.
Disable XML-RPC
XML-RPC is a legacy WordPress API that is frequently abused for brute force amplification attacks (one request = thousands of attempts).
Unless you specifically need it (Jetpack uses it), block it in .htaccess:
<files xmlrpc.php> order allow,deny deny from all </files>
Change the Database Table Prefix
The default WordPress table prefix is wp_. Automated SQL injection attacks target this prefix directly.
During a fresh install, change it to a random string like x7k2m_.
For existing sites, use a plugin like Brozzme DB Prefix Changer: and always backup first.
Security Keys in wp-config.php
WordPress uses secret keys to secure cookies. Generate fresh keys at
api.wordpress.org/secret-key
and replace the placeholder lines in wp-config.php.
Regenerating keys immediately invalidates all active sessions: useful after a breach.
HostSSD includes ModSecurity WAF, CPGuard malware scanner, and CloudLinux on all plans. Your WordPress site gets protected at the infrastructure layer before requests even reach PHP.
See SSD Web Hosting plans | See Turbo SSD plansStep 6: Force HTTPS and Configure SSL Correctly
HTTPS encrypts all communication between your visitors and your server. Without it, login credentials, form submissions, and personal data travel in plain text and can be intercepted.
- Install a free Let's Encrypt SSL certificate: available on all HostSSD plans
- Force HTTPS redirect via
.htaccessor your hosting control panel - Install the Really Simple SSL plugin to fix mixed content warnings automatically
- Enable HSTS (HTTP Strict Transport Security) for maximum browser enforcement
- Check your SSL grade at SSL Labs: aim for A or A+
Google uses HTTPS as a ranking signal. A site without SSL is flagged as "Not Secure" in Chrome, which destroys visitor trust and conversion rates.
Step 7: Automated Backups and Disaster Recovery
Backups do not prevent attacks, but they are the only reliable way to recover from one without losing everything. A site with no backup after a ransomware attack or database corruption is effectively gone.
- Daily automated backups: never rely on manual-only backups
- Off-site or cloud storage: keep copies away from the same server (S3, Google Drive, Dropbox)
- Test restores regularly: a backup you have never tested is not a backup
- Keep at least 30 days of backup history: malware can be dormant before activation
- Use UpdraftPlus or BackWPup for plugin-level backups with remote storage
All HostSSD plans include daily automated backups with one-click restore directly from cPanel.
Step 8: Choose Hosting With Server-Level Security (CloudLinux, WAF, CPGuard)
Your hosting environment determines the baseline security of every WordPress site you run. A poorly configured shared host can expose your files to other accounts on the same server: a vulnerability no plugin can fix.
What to Look for in Secure Hosting
- CloudLinux account isolation: each account runs in its own isolated container
- CPGuard or Imunify360: server-side malware scanner and real-time protection
- ModSecurity WAF: web application firewall at the Apache/LiteSpeed level
- Free SSL with auto-renewal: no manual certificate management
- PHP version selection: ability to run PHP 8.x per account
- SSH access: for secure file management and WP-CLI operations
- DDoS protection: network-level mitigation
- 24/7 human support: real people who know WordPress, not bots
Step 9: Harden Your WordPress Database
The database stores everything: posts, users, passwords, and settings. A successful SQL injection attack gives an attacker full control of your site.
- Change the default table prefix from
wp_to a random string likex7k2m_. Automated SQL injection attacks target the default prefix directly. - Use a dedicated database user with only the permissions your site actually needs (SELECT, INSERT, UPDATE, DELETE). Never use the root MySQL user.
- Restrict database access by host: the database user should only accept connections from
localhost - Disable remote MySQL access: unless explicitly needed, block port 3306 at the firewall level
- Rotate database credentials after any suspected breach or personnel change
Step 10: Enforce Least Privilege: Manage User Roles Correctly
WordPress has five built-in roles: Administrator, Editor, Author, Contributor, and Subscriber. Most compromises involving insider access happen because users have more permissions than they need.
- Minimize Administrator accounts: only assign Admin to users who genuinely manage the site infrastructure
- Use Editor role for content managers: they can publish and edit posts without touching settings or plugins
- Audit user accounts regularly: remove accounts of former employees, contractors, or inactive collaborators immediately
- Disable user registration if your site does not require it: Settings → General → uncheck "Anyone can register"
- Monitor for new admin creation: configure Wordfence to send email alerts when a new Administrator account is created
Step 11: Configure HTTP Security Headers
Security headers are HTTP response headers that tell the browser how to behave when handling your site's content. They protect against clickjacking, XSS injection, and MIME-type sniffing attacks with zero plugin overhead.
Add these to your .htaccess file:
# Prevent clickjacking Header always set X-Frame-Options "SAMEORIGIN" # Block MIME-type sniffing Header always set X-Content-Type-Options "nosniff" # Enable XSS filter in older browsers Header always set X-XSS-Protection "1; mode=block" # Enforce HTTPS for 1 year (HSTS) Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" # Control referrer information Header always set Referrer-Policy "strict-origin-when-cross-origin" # Restrict browser features Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
After adding these headers, verify your score at securityheaders.com. Aim for grade A or A+.
Step 12: Monitor Your Site Continuously
Security is not a one-time configuration. It is an ongoing process. A site that was secure last month may have a new vulnerable plugin today.
- Enable Wordfence email alerts for failed logins, new admin accounts, plugin changes, and malware detections
- Schedule weekly Wordfence scans: do not rely on manual-only scanning
- Check Google Search Console for manual actions or hacked site warnings
- Use WPScan CLI or WPScan API to audit your plugins against the vulnerability database regularly
- Monitor uptime with a free tool like UptimeRobot. A hacked site often goes down or starts redirecting traffic.
- Check your SSL certificate expiry: all HostSSD plans include auto-renewal, but manually verify every 60 days
- Review server logs monthly: unusual spikes in POST requests to
/wp-login.phpor/xmlrpc.phpsignal active attacks
A monitored site is a defended site. Most WordPress compromises go undetected for weeks. Continuous monitoring cuts mean time to detection from days to minutes.
Frequently Asked Questions
How do I secure a WordPress site for free?
Install Wordfence (free tier), enable 2FA, update all plugins and themes, enforce HTTPS with a free Let's Encrypt certificate, and set correct file permissions. These steps cover the majority of attack vectors at no cost.
Is Wordfence enough to secure WordPress?
Wordfence covers application-level threats very well. However, it cannot protect against server-level vulnerabilities like account cross-contamination or kernel exploits. A host with CloudLinux isolation and a server-side WAF (ModSecurity) provides the complementary layer Wordfence cannot.
What is the most common way WordPress sites get hacked?
Outdated or vulnerable plugins account for over 90% of WordPress compromises. The second most common vector is weak or reused admin credentials. Keeping plugins updated and using strong 2FA-protected passwords eliminates most attack surface.
Should I disable XML-RPC on WordPress?
Yes, in most cases. XML-RPC is exploited for brute force amplification attacks where a single request can test thousands of passwords. Disable it via .htaccess unless you actively use Jetpack or a mobile app that requires it.
How often should I back up my WordPress site?
Daily automated backups are the minimum for any active site. For e-commerce or high-traffic sites, hourly or real-time backups (via JetBackup or BlogVault) are recommended. Always store backups off-site and test restores periodically.
Key Takeaways: 12-Step Security Checklist
- Keep WordPress core, themes, and plugins updated: this alone prevents most hacks
- Install and configure Wordfence: firewall, malware scanner, and 2FA in one plugin
- Secure /wp-admin with 2FA, login limits, and a custom login URL
- Harden wp-config.php, set correct file permissions, and disable XML-RPC
- Force HTTPS with a valid SSL certificate and HSTS
- Run daily automated backups with off-site storage and tested restores
- Choose hosting with server-level security: CloudLinux, CPGuard, ModSecurity WAF
- Harden your database: change the default table prefix and restrict user permissions
- Enforce least privilege: minimize admin accounts and audit users regularly
- Add HTTP security headers: X-Frame-Options, HSTS, Content-Type-Options via .htaccess
- Monitor continuously: Wordfence alerts, uptime monitoring, and weekly vulnerability scans
Ready to protect your WordPress site starting from the server?
Explore
HostSSD WordPress Hosting
with CloudLinux isolation, CPGuard, free SSL, and 24/7 human support.
Or compare all plans at
SSD Web Hosting
.