Home / Security / WordPress Hardening Checklist: Secure Your Website Step by Step

WordPress Hardening Checklist: Secure Your Website Step by Step

Mohsin Shakeel

WordPress powers over 40 percent of the web, making it a primary target for hackers, automated botnets, and malicious code injection. To protect your site, implementing a comprehensive WordPress hardening checklist is the most effective proactive defense strategy. Hardening involves locking down vulnerabilities across your application, file architecture, database, and web server to dramatically minimize your attack surface.

In this guide, we will walk you through a complete, step-by-step WordPress hardening checklist covering everything from basic file permissions to advanced server-level security headers. Whether you run a personal blog, an e-commerce store, or an enterprise portal, executing these steps will significantly improve your website’s resilience against cyber threats.

Why WordPress Hardening Is Essential

By default, WordPress is engineered with solid core security. However, default configurations prioritize broad compatibility and ease of installation over maximum lock-down. Consequently, out-of-the-box setups leave common entry points exposed to brute-force attacks, cross-site scripting (XSS), SQL injection, and unauthorized file edits.

Therefore, executing a strict WordPress hardening checklist bridges the gap between basic site setup and enterprise-level defense. Rather than waiting for a breach to occur, hardening establishes multiple defensive layers—meaning if an attacker bypasses one barrier, additional barriers prevent full system compromise.

1. File System & File Permissions Security

Incorrect file permissions allow attackers to write malicious code directly into core WordPress files or upload webshells into your media directory. Setting strict permissions ensures the server web user can only read or execute files where necessary.

Recommended WordPress File Permissions

Use the following standard permission schema across your entire file tree:

  • Directories: 755 or 750
  • Files: 644 or 640
  • wp-config.php: 600 or 440
  • .htaccess / nginx.conf: 644 or 600

You can apply these permissions via SSH using the following find commands:

# Set directory permissions to 755
find /path/to/wordpress/ -type d -exec chmod 755 {} \;

# Set file permissions to 644
find /path/to/wordpress/ -type f -exec chmod 644 {} \;

# Secure wp-config.php
chmod 600 /path/to/wordpress/wp-config.php

For more details on automating command-line site management, read our guide on WP-CLI for Beginners.

2. Login Security & User Access Control

Brute-force credential stuffing is one of the most widespread security threats facing web administrators. Strengthening your login flow deters credential harvesting and unauthorized access attempts.

Key Login Hardening Measures

  1. Enforce Strong Passwords and Two-Factor Authentication (2FA): Require all user accounts, especially administrators and editors, to use multi-factor authentication via apps like Google Authenticator or Authy.
  2. Limit Login Attempts: Restrict the number of failed login attempts per IP address using a security plugin or firewall rule to prevent automated dictionary attacks.
  3. Rename or Hide wp-login.php: Change the default login URL (e.g., to /my-custom-login) to obscure your login page from automated scanner bots.
  4. Disable User Enumeration: Block access to author archives by query parameters (e.g., /?author=1) which disclose active admin usernames.
  5. Enforce Principle of Least Privilege: Assign users only the minimum roles required (e.g., Author instead of Administrator) and periodically audit inactive accounts.

3. SSL/TLS Encryption & HTTPS Enforcement

An active SSL/TLS certificate encrypts data in transit between your visitors’ browsers and your web server, protecting sensitive information like session cookies and login credentials from interception.

To enforce HTTPS effectively across your WordPress installation:

  • Obtain an SSL certificate (e.g., free via Let’s Encrypt or through your hosting provider).
  • Update your site addresses under Settings > General to use https://.
  • Enforce SSL for logins and admin pages by adding the following line to your wp-config.php file:
define('FORCE_SSL_ADMIN', true);

Additionally, implement HTTP Strict Transport Security (HSTS) headers to force browsers to always connect via encrypted HTTPS connections.

4. Hardening the WordPress Database

Your database stores all page content, user accounts, options, and plugin data. If an attacker gains SQL execution access, they can alter account privileges or dump sensitive customer data.

Database Hardening Steps

  • Change Default Database Prefix: During installation (or retroactively using security tools), change the default wp_ table prefix to a unique random string (e.g., wp_x89z_). This mitigates targeted SQL injection scripts that assume standard table names.
  • Use Dedicated Database User Credentials: Never connect WordPress using the database root account. Create an isolated MySQL user with privileges restricted strictly to the WordPress database.
  • Perform Regular Database Backups: Store encrypted database backups offsite in secure cloud storage. For recommended backup workflows, see our [Internal Link: WordPress Backup Guide].

5. Securing the wp-config.php File

The wp-config.php file contains sensitive configuration details, including database passwords and security keys. Protecting this file is a vital pillar of any effective WordPress hardening checklist.

Disable Built-In File Editing

Prevent logged-in administrators (or compromised admin accounts) from editing PHP code directly within the WordPress dashboard by adding this line to wp-config.php:

define('DISALLOW_FILE_EDIT', true);

Disable Uncontrolled File Modifications

If you want to prevent users from installing or updating plugins and themes directly from the admin dashboard in production environments, disable file modifications entirely:

define('DISALLOW_FILE_MODS', true);

Update Security Keys and Salts

Ensure high-entropy authentication keys and salts are defined in your configuration. You can generate fresh keys directly from the official WordPress.org Salt Generator.

6. Server-Level Configuration & Rules

Server-side security halts attacks before they ever execute PHP script execution inside WordPress, conserving server resources and providing robust protection.

Securing Apache (.htaccess)

If your web server runs on Apache, place the following security rules in your root .htaccess file:

# Block access to wp-config.php
<Files wp-config.php>
order allow,deny
deny from all
</Files>

# Block access to sensitive files
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh)$">
Order allow,deny
Deny from all
</FilesMatch>

# Disable Directory Browsing
Options -Indexes

Prevent PHP Execution in Uploads Directory

The /wp-content/uploads/ folder should only host static media assets. Prevent execution of malicious PHP scripts by creating an .htaccess file inside /wp-content/uploads/ with:

<Files *.php>
deny from all
</Files>

7. Advanced Protection Methods

Beyond traditional configuration steps, modern site defense requires proactive threat filtering and surface reduction.

Disable XML-RPC API

The legacy xmlrpc.php interface is frequently abused for brute-force amplification and DDoS amplification attacks. Unless you require integration with legacy desktop publishing tools, disable XML-RPC completely.

You can block XML-RPC requests via .htaccess:

<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>

Deploy a Web Application Firewall (WAF)

A Cloud WAF (such as Cloudflare or Sucuri) inspects incoming traffic at the edge before it reaches your hosting server. WAFs automatically block known exploit signatures, bot networks, and malicious request patterns.

Configure Essential HTTP Security Headers

Security headers tell the user’s browser how to handle site content safely. Ensure your server sends the following headers:

HTTP Security HeaderRecommended Value / ActionSecurity Benefit
Strict-Transport-Securitymax-age=31536000; includeSubDomainsEnforces HTTPS connections exclusively.
X-Frame-OptionsSAMEORIGINPrevents clickjacking frame embedding.
X-Content-Type-OptionsnosniffPrevents MIME-type sniffing vulnerabilities.
Content-Security-Policydefault-src 'self'; ...Restricts unauthorized script sources (XSS mitigation).

8. Security Monitoring & Automated Backups

Security is an ongoing process rather than a one-time project. Continuous monitoring guarantees swift incident response if an anomaly occurs.

  • File Integrity Monitoring: Use plugins or server tools (e.g., Wordfence, MalCare, or AIDE) to monitor core file modifications.
  • Automated Offsite Backups: Schedule daily automated backups (files and database) stored securely on independent cloud storage (e.g., AWS S3, Google Cloud Storage). Verify restore procedures periodically.
  • Keep Core, Plugins, and Themes Updated: Vulnerable plugins account for over 90% of WordPress security breaches. Apply security patches promptly.

WordPress Hardening Checklist Summary Table

Use this quick reference checklist to audit your WordPress security implementation status:

Security LayerHardening ActionStatus
File PermissionsSet directories to 755/750 and files to 644/640; wp-config to 600[ ] Pending
AuthenticationEnable 2FA and limit failed login attempts[ ] Pending
Transport SecurityEnforce HTTPS and enable FORCE_SSL_ADMIN[ ] Pending
Configuration SecurityDisable file editor (`DISALLOW_FILE_EDIT`)[ ] Pending
Database SecurityCustom database prefix and isolated MySQL user[ ] Pending
Server RulesDisable PHP execution in `/wp-content/uploads/`[ ] Pending
API ProtectionDisable XML-RPC access[ ] Pending
Edge DefenseImplement Cloud WAF and HTTP Security Headers[ ] Pending

By following this WordPress hardening checklist, you build an exceptionally resilient security architecture that shields your digital assets from current and emerging cyber threats. For further technical tutorials and site administration techniques, explore our comprehensive collection of WordPress guides and tutorials.

Related Blogs

Learn how to make your website fully inclusive with our complete WordPress accessibility guide. Explore WCAG guidelines, color contrast standards, keyboard navigation, ARIA attributes, and top accessibility plugins.
An in-depth comparison of Elementor vs Bricks vs Divi vs Gutenberg covering performance, ease of use, dynamic content, dynamic queries, AI features, and ideal user profiles.
Explore the best AI plugins for WordPress in 2026 to automate content writing, image creation, SEO optimization, customer support chatbots, custom code generation, and site workflows.