Every 39 seconds, a website is attacked somewhere on the internet. WordPress, powering over 43% of all websites, is the single most targeted platform. In 2025 alone, Wordfence reported blocking over 90 billion malicious login attempts across WordPress sites. That's not a typo — billion, with a B.
The reality is that most WordPress hacks are preventable. Over 95% of successful attacks exploit known vulnerabilities that have already been patched, weak passwords, or misconfigured hosting. This guide walks you through every layer of WordPress security, from server-level hardening to daily practices that keep attackers out.
Understanding the Threat Landscape
Before you can defend your site, you need to understand how attackers operate. WordPress hacks fall into five main categories:
1. Brute Force Attacks
Automated bots try thousands of username/password combinations per minute until they find one that works. This is the most common attack vector, responsible for roughly 30% of all WordPress compromises. The default "admin" username and weak passwords like "password123" make it trivially easy.
2. Vulnerable Plugins and Themes
Plugins and themes are the #1 entry point for WordPress malware. A 2025 analysis by Patchstack found that 96% of new WordPress vulnerabilities came from plugins, 3.4% from themes, and only 0.6% from WordPress core. Outdated plugins with known exploits are the easiest targets.
3. SQL Injection
Attackers insert malicious SQL code through input fields (search boxes, contact forms, URL parameters) to manipulate your database. Successful SQL injection can expose user data, create admin accounts, or inject malicious content into your posts.
4. Cross-Site Scripting (XSS)
Malicious JavaScript is injected into your site's pages, typically through vulnerable plugins or unsanitized input fields. XSS attacks can steal visitor cookies, redirect users to phishing sites, or deface your content.
5. File Inclusion Exploits
Attackers exploit vulnerabilities that allow them to include and execute files on your server. This can lead to backdoor installation, cryptocurrency mining scripts, or complete server takeover.
"The question isn't whether your WordPress site will be attacked — it's whether it's prepared when the attack comes. Every site on the internet receives malicious traffic. The difference between a secure site and a compromised one is preparation."
Layer 1: Server-Level Security
Security starts at the server. No amount of plugin-level protection compensates for insecure hosting infrastructure.
Choose a Host with Built-in Security
Your hosting provider should offer these security features as standard, not premium add-ons:
- Web Application Firewall (WAF) — Filters malicious traffic before it reaches your WordPress installation. Server-level WAFs like ModSecurity are far more effective than plugin-based alternatives.
- DDoS protection — Absorbs volumetric attacks that attempt to overwhelm your server with traffic. Enterprise-grade DDoS mitigation should be included, not extra.
- Malware scanning — Automatic daily scans of your files and database for known malware signatures and suspicious code patterns.
- Account isolation — On shared hosting, your account should be isolated from other accounts on the same server. If another site gets hacked, yours should be unaffected.
- Automatic backups — Daily backups stored in a separate location from your website files. If your site is compromised, you need a clean backup to restore from.
Serverlys Tip: Our WordPress hosting includes a server-level WAF, DDoS protection, daily malware scanning, isolated accounts, and automatic daily backups on all plans. Security isn't an upsell — it's built into every account.
Keep PHP Updated
Running an outdated PHP version is one of the most overlooked security risks. PHP 7.4 reached end of life in November 2022 and no longer receives security patches, yet millions of WordPress sites still run it. Each unpatched PHP vulnerability is an open door for attackers.
In 2026, you should be running PHP 8.2 or 8.3 at minimum. Check your PHP version in WordPress under Tools > Site Health, or ask your hosting provider to update it.
Enforce SSL/HTTPS
SSL encrypts data transmitted between your visitors and your server, preventing man-in-the-middle attacks that can intercept login credentials, payment information, and personal data. Every page on your site should load over HTTPS — not just your login page.
Your host should provide free SSL certificates (typically via Let's Encrypt) with automatic renewal. If you're paying for basic SSL in 2026, switch hosts.
Layer 2: WordPress Configuration Hardening
Secure Your wp-config.php File
The wp-config.php file contains your database credentials and authentication keys. It's the single most sensitive file in your WordPress installation. Protect it with these steps:
- Move it above the web root. WordPress can access wp-config.php from one directory above your web root. This means attackers who gain limited file access can't reach it via URL.
- Set restrictive file permissions. Set wp-config.php to 400 or 440 (read-only for the owner). Never leave it at 644 or 666.
- Generate fresh security keys. Visit api.wordpress.org/secret-key/1.1/salt/ to generate new authentication keys and replace the ones in wp-config.php. Do this annually or after any suspected compromise.
- Disable file editing. Add
define('DISALLOW_FILE_EDIT', true);to wp-config.php to prevent editing theme and plugin files from the WordPress admin. If an attacker gains admin access, this stops them from injecting code through the built-in editor.
Change the Default Database Table Prefix
WordPress uses "wp_" as the default database table prefix. Every automated SQL injection tool assumes this prefix. Changing it to something unique (like "sv7x_") won't stop a determined attacker, but it stops automated attack scripts cold.
For existing sites, changing the table prefix requires updating both the database tables and references in wp-config.php. Plugins like Brozzme DB Prefix can handle this automatically.
Disable XML-RPC
XML-RPC is an older WordPress API that enables remote publishing and pingbacks. In 2026, it's rarely needed (the REST API has replaced its functionality) but is frequently exploited for brute force amplification attacks. A single XML-RPC request can test hundreds of password combinations simultaneously.
Disable XML-RPC by adding a rule to your .htaccess file or using a security plugin. If you use Jetpack or the WordPress mobile app, you may need to keep it enabled — but add rate limiting.
Layer 3: Access Control
Strong Passwords Are Non-Negotiable
The #1 cause of WordPress hacks is weak passwords. "Admin123" and "password" are still in the top 10 most commonly compromised passwords. Every account on your WordPress site should use:
- At least 16 characters (longer is better)
- A mix of uppercase, lowercase, numbers, and symbols
- A unique password not used on any other site
- A password manager (1Password, Bitwarden, or LastPass) to generate and store passwords
Enable Two-Factor Authentication (2FA)
Even the strongest password can be compromised through phishing or data breaches. Two-factor authentication adds a second verification step — typically a time-based code from an authenticator app — that an attacker can't bypass even with your password.
Recommended 2FA plugins:
- WP 2FA — Simple, works with Google Authenticator and Authy
- Wordfence Login Security — Free, includes 2FA and CAPTCHA
- Two-Factor — Official WordPress plugin, lightweight
Enable 2FA for all administrator and editor accounts at minimum. Ideally, require it for every user who can log in.
Limit Login Attempts
WordPress allows unlimited login attempts by default, which is exactly what brute force bots exploit. Rate-limit login attempts to 3–5 per 15-minute window, then lock the IP out for increasing durations.
| Security Plugin | Firewall | Malware Scan | 2FA | Login Limits | Price |
|---|---|---|---|---|---|
| Wordfence | Yes (application-level) | Yes | Yes | Yes | Free / $119/yr |
| Sucuri | Yes (cloud WAF) | Yes | No | Yes | $199/yr |
| iThemes Security | Partial | Via Sucuri | Yes | Yes | Free / $99/yr |
| All In One WP Security | Basic | Basic | Yes | Yes | Free |
| Patchstack | Yes (virtual patching) | Via integration | No | Yes | Free / $99/yr |
Change the Login URL
By default, every WordPress login page is at /wp-admin or /wp-login.php. Every bot on the internet knows this. Changing your login URL to something custom (like /my-secure-login) immediately eliminates 99% of automated brute force attempts because the bots can't find your login page.
Use the WPS Hide Login plugin (free, lightweight) or your security plugin's built-in feature to change the login URL.
Layer 4: Plugin and Theme Security
Keep Everything Updated
This is the most important security practice, and the one most often neglected. When a plugin vulnerability is disclosed, attackers begin scanning for unpatched sites within hours. The window between disclosure and mass exploitation is shrinking — in some cases, it's less than 24 hours.
- Enable automatic minor updates for WordPress core (this is on by default)
- Enable automatic plugin updates for trusted plugins via the Plugins page
- Check for updates weekly at minimum — daily for high-value sites
- Use a staging environment to test major updates before applying them to your live site
- Subscribe to security advisories from Wordfence, Patchstack, or WPScan to get alerted about new vulnerabilities
Audit Your Plugins Regularly
Every plugin is a potential attack surface. Audit your plugins quarterly with these criteria:
- Last updated within 6 months? Abandoned plugins don't receive security patches.
- Active installations above 10,000? Widely used plugins get more security scrutiny.
- Compatible with your WordPress version? Incompatible plugins may have untested code paths.
- From a reputable developer? Check the developer's track record on WordPress.org.
- Do you actually use it? If not, delete it. Even deactivated plugins can be exploited.
Serverlys Tip: Our managed WordPress hosting includes automatic WordPress core, plugin, and theme updates with rollback protection. If an update breaks your site, we automatically restore the previous version.
Never Use Nulled Themes or Plugins
Nulled (pirated) themes and plugins are the fastest path to a hacked site. A 2025 study found that 98% of nulled WordPress themes and plugins contained malware, backdoors, or spam injection code. The "free" premium theme you downloaded from a random website likely contains code that sends your admin credentials to an attacker, injects hidden SEO spam links, or creates a backdoor for future access.
If you can't afford a premium theme or plugin, use a free alternative from the official WordPress.org repository. The $59 you "save" on a nulled plugin isn't worth the cleanup cost when your site gets compromised — which can easily exceed $500–$2,000.
Layer 5: Monitoring and Response
Set Up Security Monitoring
You can't respond to threats you don't know about. Implement these monitoring layers:
- File integrity monitoring — Detects unauthorized changes to WordPress core files, themes, and plugins. Wordfence and Sucuri both offer this.
- Uptime monitoring — Services like UptimeRobot (free) alert you immediately when your site goes down, which could indicate an attack or compromise.
- Google Search Console — Alerts you if Google detects malware, spam, or security issues on your site. Set up email notifications.
- Activity logging — Track who logs in, what they change, and when. WP Activity Log provides detailed audit trails that are invaluable after a security incident.
Have an Incident Response Plan
If your site is compromised, speed matters. Prepare in advance:
- Identify the type of compromise — Malware injection, defacement, spam content, redirect to malicious site, or cryptocurrency miner?
- Take the site offline — Enable maintenance mode to protect visitors while you clean up.
- Restore from a clean backup — This is often the fastest and most reliable fix. Restore a backup from before the compromise occurred.
- Change all passwords — WordPress admin, FTP, database, hosting panel, and email. Assume all credentials are compromised.
- Identify the entry point — Check access logs, review recently installed plugins, and scan for backdoors. If you don't close the entry point, you'll get hacked again.
- Update everything — WordPress core, all plugins, all themes, and PHP version.
- Request a security review from Google — If Google flagged your site as malicious, submit a reconsideration request in Search Console after cleanup.
The WordPress Security Checklist
Use this checklist to audit your WordPress security posture. Every item should be checked:
- Hosting provider includes WAF, malware scanning, and account isolation
- PHP version is 8.2 or newer
- SSL/HTTPS is active on all pages
- wp-config.php has restrictive file permissions
- File editing is disabled in WordPress admin
- Database table prefix is changed from default "wp_"
- XML-RPC is disabled (unless needed for specific functionality)
- All admin accounts use strong, unique passwords
- Two-factor authentication is enabled for all admin accounts
- Login attempts are rate-limited
- Login URL is changed from default /wp-admin
- All plugins and themes are updated to latest versions
- Unused plugins and themes are deleted (not just deactivated)
- No nulled or pirated themes/plugins are installed
- Automatic backups run daily and store copies off-server
- File integrity monitoring is active
- Uptime monitoring is configured with email alerts
- Google Search Console is connected and notifications are enabled
"Security is not a product you install once — it's a process you maintain continuously. The sites that stay secure are the ones that treat security as an ongoing practice, not a one-time setup."
Frequently Asked Questions
How do I know if my WordPress site has been hacked?
Common signs include: unexpected redirects to other websites, new admin users you didn't create, unfamiliar files in your WordPress directories, Google Search Console security warnings, dramatic changes in traffic, your site loading unusually slowly, spam content appearing in your posts or pages, and your host suspending your account for malware. Run a security scan with Wordfence or use Sucuri SiteCheck (free online scanner) if you suspect a compromise.
Is Wordfence or Sucuri better for WordPress security?
Both are excellent but serve different purposes. Wordfence runs on your server and provides a thorough application-level firewall and malware scanner — it's the better choice for comprehensive, all-in-one security. Sucuri operates as a cloud-based WAF that filters traffic before it reaches your server — it's better for sites that need DDoS protection and want to offload security processing from their server. For most small business sites, Wordfence's free plan provides outstanding protection.
How often should I back up my WordPress site?
Daily backups are the minimum for any site that changes regularly. Ecommerce sites should back up multiple times per day (every 6–12 hours) since orders and customer data change constantly. Store backups in at least two locations: your host's backup system and an external service like Google Drive, Amazon S3, or Dropbox via a plugin like UpdraftPlus.
Can WordPress ever be truly secure?
No software is 100% secure, but WordPress can be made extremely secure with proper hardening. The WordPress core itself has a strong security track record — most vulnerabilities come from third-party plugins and themes. By following the practices in this guide, you reduce your attack surface to the point where only sophisticated, targeted attacks pose a real risk — and those attackers typically target much higher-value targets than small business websites.
Is a security plugin necessary if my host has built-in security?
Host-level security and plugin-level security complement each other. Your host handles server-level threats (DDoS, network attacks, server vulnerabilities), while a security plugin handles application-level threats (brute force, malware in plugins, file integrity). For maximum protection, use both. At minimum, install a free security plugin like Wordfence even if your host provides server-level security.