How to Secure WordPress Site: The Best, Proven Method 2026
Most “how to secure WordPress site” articles say the same three things: install a security plugin, use strong passwords, keep everything updated. That’s true, but it’s also incomplete it’s the surface-level advice, not what actually stops real attacks. Here’s a more complete breakdown of how to secure WordPress site, including the hardening steps that most beginner guides skip entirely.
Why WordPress Sites Get Targeted
WordPress powers a huge share of the web, which makes it a high-value target for automated attacks. Almost no hacker is manually targeting your specific site — instead, bots scan millions of sites looking for known vulnerabilities: outdated plugins, weak login credentials, and misconfigured files. This is actually good news: most attacks are automated and preventable with the right hardening steps, not sophisticated targeted hacking.
Step 1: Lock Down Login Access for how to secure wordpress site
This is the most common attack vector, and it needs more than “use a strong password.”
- Enable two-factor authentication (2FA) on all admin accounts this alone blocks the vast majority of brute-force login attempts even if a password is compromised
- Limit login attempts so repeated failed logins trigger a temporary lockout
- Rename the default “admin” username if you’re still using it bots specifically target this username since it used to be the WordPress default
- Change your login URL from the default
/wp-adminor/wp-login.phpto something custom, which stops a huge percentage of automated bot scans before they even reach your login form
Step 2: Harden wp-config.php
This file contains your database credentials and core configuration, making it one of the most sensitive files on your site.
- Move
wp-config.phpone directory above your WordPress root if your hosting setup allows it this makes it inaccessible via direct URL - Add unique security keys and salts (available from the WordPress.org secret key generator) to invalidate old session cookies if a breach is suspected
- Disable file editing from the WordPress dashboard by adding:
define('DISALLOW_FILE_EDIT', true);This prevents an attacker who gains admin access from editing theme/plugin files directly through the dashboard
Step 3: Fix File and Folder Permissions
Incorrect file permissions are a commonly overlooked vulnerability. The general safe standard:
- Folders:
755 - Files:
644 wp-config.php:600(or440on some hosts) the most restrictive, since it holds your database credentials
Overly permissive settings (like 777) allow far more write access than necessary, which is exactly what an attacker exploits if they find any entry point.
Step 4: Disable XML-RPC (If You Don’t Need It)
XML-RPC is a WordPress feature that allows remote connections useful for things like the WordPress mobile app or certain plugins. Still, it’s also frequently abused for brute-force attacks and DDoS amplification. If you don’t specifically need it (many sites don’t), disabling it removes an entire attack surface.
Step 5: Add Security Headers
Most WordPress security guides skip this entirely, but HTTP security headers are a real, meaningful layer of protection:
- Content-Security-Policy restricts which sources can load scripts on your site
- X-Frame-Options prevents your site from being embedded in a malicious iframe (clickjacking protection)
- X-Content-Type-Options stops browsers from misinterpreting file types in ways attackers can exploit
Many hosting providers let you add these through .htaccess or a server config panel; some security plugins also offer this as a feature.
Step 6: Set Up a Web Application Firewall (WAF)
A WAF filters malicious traffic before it even reaches your WordPress installation, blocking common attack patterns (SQL injection attempts, malicious bot traffic) at the network level rather than relying on WordPress itself to catch everything.
Step 7: Keep Everything Updated But Verify After Updating
Yes, this is the advice everyone gives, but there’s a nuance most guides skip: always check your site after updating, not just before. An update can silently reintroduce a vulnerability if it rolls back a security-related setting, or occasionally an update itself can be compromised (this has happened with popular plugins in the past). Don’t treat “updated” as automatically “secure” verify.
Step 8: Run Regular Malware Scans
Even with strong prevention, periodic scanning catches anything that slips through. Look for a scanner that checks:
- Core file integrity (comparing your files against the official WordPress repository)
- Known malware signatures
- Suspicious recently-modified files
Step 9: Maintain Verified, Offsite Backups
If every other layer fails, a clean, tested backup is what actually saves you. Store backups off-server, and periodically confirm you can actually restore from one an untested backup is a false sense of security.
Security Hardening Checklist
| Layer | Action |
|---|---|
| Login | 2FA, limit login attempts, custom login URL |
| Configuration | Harden wp-config.php, disable file editing |
| File system | Correct file/folder permissions |
| Attack surface | Disable unused XML-RPC |
| Network | Security headers, Web Application Firewall |
| Maintenance | Update + verify, regular malware scans |
| Recovery | Verified offsite backups |
Frequently Asked Questions for how to secure WordPress site
Is a security plugin enough on its own? A good security plugin covers several of these layers (login protection, malware scanning, firewall features). Still, server-level hardening (file permissions, wp-config protection) usually needs to be done separately, either manually or through your host.
How often should I run a malware scan? Weekly is a reasonable baseline for most sites; daily scans are worth it for high-traffic or e-commerce sites where a breach would be more costly.
Does changing my login URL actually help, or is it just “security through obscurity”? It genuinely helps in practice — the vast majority of brute-force attempts are automated bots hitting the default /wp-admin URL, so moving it eliminates that entire category of attack even though it’s not a substitute for strong authentication.
What’s the very first thing I should do if I suspect my site has already been hacked? Change all passwords immediately (WordPress admin, hosting, FTP), then run a full malware scan, and restore from a clean backup if the scan confirms compromised files.
Final Thoughts for how to secure wordpress site
Learning how to secure a WordPress site properly means going beyond “install a plugin and update regularly.” Layer your defenses login hardening, file permissions, security headers, and a firewall so that no single weak point can bring the whole site down. If your site needs a full security audit and hardening, get in touch here, and I’ll handle it directly.
This post contains affiliate links. See our [Affiliate Disclosure] for details.
Recommended Tools & Plugins
Every tool below is something I actually use on client projects, not a random affiliate list.
- Hosting: Cloudways fast, managed WordPress hosting
- Domain: Namecheap reliable registrar with free WHOIS privacy
- Theme: GeneratePress lightweight, built for speed
- Page Builder: Elementor Pro the builder behind most of my client sites
- Forms: WPForms reliable, beginner-friendly form builder
- Directory/Listing Sites: Directorist for business directory or listing projects
- Elementor Add-ons: Crocoblock (JetEngine) for dynamic, database-driven sites
- Keyword Research: Mangools is the SEO tool I use for keyword research
- Backups: UpdraftPlus never launch a site without a backup plan
- Course Platform: Tutor LMS is the LMS plugin