WordPress powers over 40% of all websites on the internet — from personal blogs to enterprise e-commerce platforms.
That popularity comes with a significant downside: WordPress is also the most attacked platform on the internet. Automated bots scan millions of WordPress sites daily, probing for known vulnerabilities in outdated plugins, weak passwords, and misconfigured servers.
The good news: the vast majority of successful WordPress attacks are entirely preventable. They exploit known, patchable vulnerabilities — not sophisticated zero-day exploits. A properly hardened WordPress site is orders of magnitude more resilient than a default installation.
This guide covers every layer of defense in the order you should implement them.
Why WordPress Sites Get Hacked
Before building your defense, understand how attacks actually happen.
| Attack Vector | Percentage of Breaches |
|---|---|
| Vulnerable plugins and themes | ~55% |
| Weak or compromised credentials | ~20% |
| Brute force login attacks | ~15% |
| Vulnerable WordPress core | ~5% |
| Server-level exploits | ~5% |
The pattern is consistent: most WordPress hacks are opportunistic, not targeted. Automated bots scan for known vulnerable plugin versions and exploit them at scale. Keeping software updated alone eliminates the majority of attack surface.
Layer 1: Secure Your Hosting Foundation
Security starts before WordPress is even installed. Your hosting environment is the foundation everything else sits on.
Choose Managed WordPress Hosting
Managed WordPress hosting providers handle server-level security on your behalf — automatic updates, server-side malware scanning, WAF integration, and daily backups are typically included. For business-critical sites, the cost of managed hosting is far less than the cost of a successful breach.
Ensure Your Server Runs Current Software
- PHP 8.1 or higher — PHP 7.x is end-of-life and actively exploited
- MySQL 8.0+ or MariaDB 10.6+
- Apache or Nginx with current security patches
- Valid SSL/TLS certificate — HTTPS is non-negotiable
Use SFTP Instead of FTP
Standard FTP transmits credentials in plain text. Always use SFTP or SSH for file transfers. Disable plain FTP entirely in your hosting control panel.
Isolate Your WordPress Installation
On shared hosting, ensure your WordPress installation runs in its own isolated environment. A compromised neighboring site should not be able to access your files.
Layer 2: Harden WordPress Core Configuration
Move wp-config.php Above the Web Root
wp-config.php contains your database credentials and security keys.
Moving it one directory above public_html prevents direct web access.
WordPress automatically looks one level up for this file.
Disable File Editing via Dashboard
WordPress allows admin users to edit theme and plugin files directly from the dashboard. Disable this immediately:
// Add to wp-config.php
define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);
Refresh Security Keys and Salts
Generate fresh keys at api.wordpress.org/secret-key/1.1/salt
and replace the existing keys in wp-config.php. Do this immediately
after any suspected compromise — it invalidates all existing sessions.
Restrict Database User Permissions
Your WordPress database user only needs SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, and ALTER permissions. Remove SUPER, FILE, and GRANT — WordPress doesn't need them, and they give attackers elevated access if credentials are compromised.
Layer 3: Secure the Login System
The WordPress login page is the most attacked endpoint on any WordPress site. Brute force tools hammer it thousands of times per hour on unprotected installations.
Change the Default Login URL
Move your login page away from the default /wp-login.php. Plugins
like WPS Hide Login allow you to set a custom login URL —
eliminating the majority of automated brute force attempts immediately.
Limit Login Attempts
Configure lockouts after failed login attempts:
- 3–5 failed attempts before lockout
- 20–30 minute initial lockout duration
- Escalating lockout for repeat offenders
Limit Login Attempts Reloaded or Wordfence handle this effectively.
Enforce Strong Passwords
Enforce strong passwords for all users — minimum 12 characters, mixed case, numbers, and symbols. Use a plugin like Password Policy Manager to make this mandatory rather than advisory.
Enable Two-Factor Authentication
2FA is one of the highest-impact single security measures available. Even with a compromised password, attackers can't log in without the second factor. Enable it for all admin and editor accounts using Wordfence Login Security or WP 2FA.
Restrict Admin Access by IP
If your team accesses WordPress admin from consistent IP addresses,
whitelist them in .htaccess:
<Files wp-login.php>
Order Deny,Allow
Deny from all
Allow from YOUR.IP.ADDRESS.HERE
</Files>
Layer 4: Plugin and Theme Security
Plugins and themes represent the largest attack surface in any WordPress installation — and the most neglected.
Audit Your Plugin List Aggressively
Apply this filter to every plugin on your site:
- Delete any plugin unused in 30+ days
- Delete any plugin not updated in 12+ months
- Delete plugins from unknown developers with minimal installs
- Update everything with an available update immediately
An inactive, deactivated plugin is still an attack surface — its files still exist on your server. Deactivated does not mean safe.
Only Install Plugins from Trusted Sources
- WordPress.org plugin directory — vetted and monitored
- Premium plugins from established developers with active support
- Never install nulled plugins or themes from unverified sources — these frequently contain backdoors
Keep Themes Minimal
Delete all unused themes including the default Twenty-something themes WordPress installs automatically. Each one is a potential attack vector.
Monitor Plugin Vulnerabilities
Subscribe to WPScan Vulnerability Database or use Wordfence to receive alerts when a plugin you're using has a disclosed vulnerability. This gives you advance warning before attackers begin exploiting a newly disclosed flaw.
Layer 5: Implement a Web Application Firewall
A WAF sits between your site and incoming traffic, filtering malicious requests before they reach WordPress. It's one of the highest-ROI security investments for any WordPress site.
Cloudflare WAF
Cloudflare's free tier includes DDoS protection, bot management, country-level blocking, and basic WAF rules. Cloudflare Pro adds OWASP ruleset enforcement and advanced bot detection — at $20/month it provides enterprise-grade WAF protection at minimal cost.
Wordfence
The most widely used WordPress-specific security plugin. Free tier includes a WordPress-specific firewall, real-time malware scanner, file integrity monitoring, login protection, and live traffic monitoring. Premium adds real-time threat intelligence updated as new threats are discovered.
Sucuri
Sucuri's cloud WAF proxies all traffic through their network, filtering threats before they reach your server. Particularly effective for sites that have experienced repeated attacks.
Layer 6: File Integrity Monitoring
File integrity monitoring tracks your WordPress files and alerts you when anything changes unexpectedly. An unauthorized file modification is often the earliest detectable sign of a compromise.
What to Monitor
- WordPress core files (
wp-admin/,wp-includes/) wp-config.phpand.htaccess- Active theme and plugin files
Wordfence includes file integrity scanning against official WordPress repository versions — it flags any core files that have been modified, giving you an immediate alert when something changes that shouldn't.
Layer 7: Backup Strategy
Backups are your last line of defense. When everything else fails, a clean recent backup is what gets your site back online.
Backup Requirements
- Daily automated backups minimum — hourly for e-commerce sites
- Off-server storage — backups on the same server are lost if the server is compromised; use Amazon S3, Google Drive, or Dropbox
- Full backups — files and database together, not just one
- Tested restores — run a test restore quarterly
- 30-day retention minimum — ensures you can restore to before a compromise that went undetected for weeks
Recommended Backup Plugins
- UpdraftPlus — most widely used; supports all major cloud storage
- BlogVault — real-time backups with one-click restore
- Jetpack Backup — real-time backup with activity log
Layer 8: SSL and Data Encryption
HTTPS is a baseline security requirement — not an optional upgrade.
- Install an SSL certificate (free via Let's Encrypt through most hosts)
- Force HTTPS for all traffic via
.htaccess:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- Enable HSTS to prevent protocol downgrade attacks
- Ensure your SSL certificate auto-renews — an expired certificate is both a security risk and an immediate trust signal failure
Layer 9: Ongoing Security Monitoring
Hardening is not a one-time task. Ongoing monitoring ensures you detect issues before they become full breaches.
What to Monitor
- Failed login attempts — a spike signals a brute force attack
- Unexpected file changes — sign of active compromise
- New admin accounts you didn't create
- Google Search Console security alerts and manual actions
- Uptime — know immediately when your site goes down
Monthly Tasks
- Apply all plugin and theme updates
- Audit user accounts — remove anyone who no longer needs access
- Review security plugin logs for anomalies
Quarterly Tasks
- Full external malware scan via Sucuri SiteCheck
- Test backup restoration
- Audit and clean plugin list
Annually
- Full security audit of the entire installation
- Review PHP version and server software
- Refresh WordPress security keys and salts
WordPress Security Checklist
Hosting & Server
- Managed hosting with server-level security
- PHP 8.1 or higher
- SFTP only — FTP disabled
- SSL installed and auto-renewing
- Daily automated backups to off-server storage
WordPress Configuration
- wp-config.php moved above web root
- File editing disabled
- Security keys refreshed
- Database permissions restricted
Login Security
- Default login URL changed
- Login attempts limited
- Strong passwords enforced
- 2FA enabled for all admins
- Admin access restricted by IP
Plugins and Themes
- All plugins and themes updated
- Unused plugins deleted
- Unused themes deleted
- Vulnerability monitoring active
Firewall and Monitoring
- WAF implemented
- File integrity monitoring active
- Google Search Console verified with alerts enabled
- Uptime monitoring configured
When to Bring in Professional Help
For businesses running mission-critical WordPress installations where downtime has direct revenue impact, ongoing WordPress security management removes the operational burden and ensures nothing falls through the cracks between reviews.
If your site has already been compromised or you're seeing unexplained ranking drops, a technical SEO and security audit can identify both the security breach and the SEO damage simultaneously — addressing both in a single structured remediation.
Frequently Asked Questions
How often should I update WordPress plugins? Update immediately when security updates are released — attackers begin exploiting newly disclosed vulnerabilities within hours of public disclosure. For feature updates, weekly is a reasonable cadence for most sites.
Is the free version of Wordfence enough for a business site? The free version provides solid baseline protection. The key limitation is that threat intelligence is delayed by 30 days on the free tier. For business sites, Wordfence Premium's real-time threat feed is worth the investment.
Can I secure WordPress on shared hosting? Yes, but with limitations. Focus on application-layer security — strong credentials, 2FA, WAF plugin, updated software — and consider upgrading to managed WordPress hosting if your site handles sensitive data or significant traffic.
What should I do if my WordPress site gets hacked despite these measures? Take the site offline immediately, change all passwords, back up the compromised version, and begin systematic cleanup starting with backdoor removal. Review server access logs to identify the entry point and close it before bringing the site back online.
Does WordPress security affect SEO? Significantly. A compromised site can be blacklisted by Google, receive manual spam penalties, and have injected spam pages indexed under your domain — all of which devastate organic search performance. Security and SEO are directly linked.
How do I know if my WordPress site is already compromised?
Run your domain through Sucuri SiteCheck and Google Safe Browsing.
Check Google Search Console for security alerts. Search
site:yourdomain.com on Google and look for pages you didn't
create. Many compromises are silent — regular scanning is the
only reliable way to catch them early.

