WordPress Security Hardening Complete Guide

WordPress powers over 43% of all websites on the internet, making it the prime target for hackers and automated bots. In 2026, attack volumes continue to rise — but the good news is that most successful hacks exploit preventable weaknesses. This guide walks you through every important WordPress security hardening step, from beginner basics to advanced configurations.

Why WordPress Is a Top Hacker Target

Understanding the attack surface helps you prioritize defenses:

⚠️ Key Statistic: According to Sucuri's 2026 report, 97% of hacked WordPress sites were infected due to outdated or vulnerable plugins and themes — not the WordPress Core itself.

Securing the Login Page

The login page is the most attacked entry point. Here is what to do:

1. Rename the "admin" Username

WordPress does not allow direct username changes. Create a new Administrator account with a different username, log in with it, then delete the original "admin" account:

1. Go to Users > Add New
2. Set a unique username (not "admin")
3. Set Role to Administrator
4. Log in with the new account
5. Delete the old "admin" user

2. Enable Two-Factor Authentication (2FA)

Install a plugin such as WP 2FA, Two Factor Authentication, or Google Authenticator. Enforce it for all Administrator-role accounts — this is one of the most impactful changes you can make.

3. Limit Login Attempts

Use Limit Login Attempts Reloaded or Login LockDown to automatically block IPs after repeated failed login attempts (e.g., block after 5 failures within 5 minutes).

4. Change the Login URL

Replace the default /wp-login.php and /wp-admin with an unpredictable path using the WPS Hide Login plugin:

# Example: change to
https://yoursite.com/secure-portal-xyz

5. Use Strong Passwords

Require passwords of at least 16 characters mixing uppercase, lowercase, numbers, and symbols. Use a password manager like Bitwarden or 1Password to manage credentials securely.

Keep WordPress, Themes & Plugins Updated

Keeping software updated is the single most impactful security measure you can take:

💡 Pro Tip: Before major updates, always backup your site and test in a staging environment before pushing to production.

Check for Vulnerable Plugins

Use WPScan Vulnerability Database or browse wpscan.com to look up known vulnerabilities in plugins you have installed.

Set Correct File Permissions

Incorrect file permissions can allow attackers to modify files directly. Recommended WordPress permissions:

File TypeRecommended PermissionNotes
Directories755Owner full, Group/Other read+execute
General Files644Owner read/write, Group/Other read-only
wp-config.php600 or 640Never 777
.htaccess644Web server must be able to read it

Set via DirectAdmin File Manager or SSH commands:

find /home/user/public_html -type d -exec chmod 755 {} \;
find /home/user/public_html -type f -exec chmod 644 {} \;
chmod 600 /home/user/public_html/wp-config.php

Disable Unnecessary Features

Disable XML-RPC

XML-RPC is a legacy remote publishing API that hackers exploit for brute force and DDoS amplification. Add to .htaccess:

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

Disable File Editing in wp-admin

Prevent theme and plugin files from being edited via the admin dashboard by adding to wp-config.php:

define('DISALLOW_FILE_EDIT', true);

Disable Directory Browsing

Add to .htaccess:

Options -Indexes

Hide WordPress Version

Add to your child theme's functions.php:

remove_action('wp_head', 'wp_generator');

Install a WAF and Security Plugin

A Web Application Firewall (WAF) filters malicious traffic before it reaches your site:

Plugin / ServiceCostKey Features
Wordfence SecurityFree / Premium ~$119/yrWAF, Malware Scan, Login Security, 2FA
Sucuri SecurityFree (Cloud WAF $199/yr)Malware Scan, File Integrity, Activity Audit
iThemes SecurityFree / Pro ~$99/yrBrute Force Protection, 2FA, Malware Scan
All In One WP SecurityFreeFirewall, Login Security, DB Security
CloudflareFree / Pro $25/moCDN + DNS-level WAF, broader coverage

💡 Recommendation: Start with Wordfence Security free tier, then consider Cloudflare Pro for DNS-level WAF as your traffic grows.

Force HTTPS

SSL is not just for SEO — it encrypts all traffic between your visitors and your server:

# Add to .htaccess to force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Then update your WordPress URLs at Settings > General to use https://, and add to wp-config.php:

define('FORCE_SSL_ADMIN', true);

Backup Strategy

A good backup covers both files and the database, stored off-site from your server:

AsiaGB Hosting includes twice-monthly automated backups (1st and 15th of each month), stored for one cycle. We recommend setting up UpdraftPlus for additional daily or weekly backups to your own cloud storage.

Harden wp-config.php

wp-config.php holds your database credentials and security keys — protect it carefully:

Regenerate Security Keys and Salts

Visit https://api.wordpress.org/secret-key/1.1/salt/ to generate new keys, then replace the existing ones in wp-config.php.

Move wp-config.php Above the Public Root

WordPress supports placing wp-config.php one directory above the document root:

/home/user/
  wp-config.php   ← move here
  public_html/
    index.php
    wp-admin/
    ...

Additional Security Flags

// Disable debug mode in production
define('WP_DEBUG', false);

// Prevent file edits from wp-admin
define('DISALLOW_FILE_EDIT', true);

// Force SSL for admin
define('FORCE_SSL_ADMIN', true);

Monitor Your Site

Early detection minimizes damage:

Security Methods Comparison Table

Security MeasureDifficultyImpactCost
Rename "admin" usernameEasyReduces brute forceFree
Enable 2FAEasyStops stolen-password loginFree
Limit login attemptsEasyBlocks brute force botsFree
Hide login URLEasyReduces bot scanningFree
Update plugins/themesEasyCloses known vulnerabilitiesFree
Set file permissionsMediumPrevents unauthorized file editsFree
Disable XML-RPCEasyCloses legacy attack vectorFree
WAF pluginEasyFilters malicious trafficFree–$199/yr
Force HTTPSEasyEncrypts all trafficFree (Let's Encrypt)
Harden wp-config.phpMediumProtects critical credentialsFree
Automated backupsEasyRecovery after an attackFree–$50/yr
Cloudflare WAFMediumDNS-level protectionFree–$25/mo

Frequently Asked Questions

Is WordPress frequently hacked?

Yes — because WordPress powers over 43% of the web, it is the top target for automated attacks. Proper hardening dramatically reduces this risk.

Should I change the WordPress login URL?

Highly recommended. Bots constantly probe /wp-admin and /wp-login.php. Changing the path with WPS Hide Login significantly cuts brute force attempts.

What is the best WordPress security plugin?

Wordfence Security is recommended for most users due to its comprehensive free tier. Sucuri provides excellent cloud-based WAF if you need DNS-level protection.

How important is 2FA for WordPress?

Extremely important. Even if a password is stolen, the attacker still needs your OTP device. Enable it for all administrator accounts.

Do I need SSL for WordPress?

Absolutely. SSL encrypts login credentials and user data, and is a Google ranking signal. Use a free Let's Encrypt certificate or purchase an SSL from AsiaGB.

How often should I backup WordPress?

High-traffic sites updated daily should backup daily. AsiaGB Hosting includes twice-monthly automated backups (1st and 15th). Use UpdraftPlus for additional automated backups to your cloud storage.

What is XML-RPC and should I disable it?

XML-RPC is a legacy remote publishing API. Hackers exploit it for brute force and DDoS. If you do not use it for remote posting or mobile apps, disable it immediately via .htaccess.

Summary: Harden WordPress Today

Most WordPress sites can be protected against 90%+ of attacks by implementing just five basic measures:

  1. Rename the "admin" account and use a strong password
  2. Enable 2FA for all administrator accounts
  3. Limit login attempts
  4. Keep WordPress, plugins, and themes updated
  5. Install Wordfence Security

💡 Server-level protection matters too: A hosting provider that includes Imunify360 or similar server-level malware protection reduces the burden of plugin-only security significantly.

Secure WordPress Hosting with Imunify360 Included

AsiaGB Web Hosting comes with Imunify360 malware protection, twice-monthly automated backups, and 99% uptime SLA — designed for WordPress.

View Hosting Plans