Securing Your WordPress Admin Area: An Expert‘s Guide

As someone who has been working with WordPress for over 15 years, I‘ve seen firsthand the damage that can be done when a site‘s admin area is compromised. Far too often, sites get hacked when attackers gain access through unused user accounts, weak passwords, or outdated plugins.

Securing your WordPress admin should be a top priority – once hackers get in, they have the keys to your whole site. I‘ve helped many clients try to recover after their admin side was breached, and it‘s a long difficult process.

In this comprehensive guide, I‘ll share the vital steps you need to lock down your WordPress admin based on my decades of security experience.

The Growing Threat Against WordPress Sites

WordPress powers over 40% of all websites, making it an obvious target for hackers. In fact, Sucuri reports that WordPress sites account for 82% of all infected websites.

The main entry point is through the admin side. Some common attacks include:

  • Brute force attacks – repeatedly trying to guess weak passwords
  • Phishing – fake login pages to steal credentials
  • Malware uploads – planting backdoors through vulnerabilities

Once in, hackers can modify site content, install more malicious code, redirect visitors, steal data and more.

For example, one client‘s site was hacked when attackers got access through an unused user account with the default "admin" password still set. They changed all the homepage content to propagate spam.

Restoring the site from backups and scrubbing the database took over a week to cleanly recover. And they nearly lost their organic search rankings in the process.

Simply put – if you don‘t properly protect wp-admin, your whole site is at risk.

1. Install a Web Application Firewall (WAF)

A WAF like Sucuri or Wordfence offers the first line of defense by monitoring all traffic to your site for suspicious activity.

It works at the server level to block SQL injections, cross-site scripting (XSS), DDoS attacks, unauthorized bots, and more. This prevents much of the malware and spam from ever reaching your site.

For example, advanced WAF rules can detect if someone is scanning your site for vulnerabilities to exploit. They can instantly block that IP address before they locate any holes in your security.

Some key benefits of implementing a WAF include:

  • Full site traffic filtering for attacks
  • Blocking based on threat reputation databases
  • Machine learning for adaptive security
  • Virtual patching of known vulnerabilities
  • Advanced rate limiting to prevent DDoS
  • Real-time monitoring with email alerts

WAFs are highly effective against automated attacks and bots seeking to breach WordPress sites through common vectors. It‘s like having an expert security team watching around the clock.

2. Hide and Password Protect wp-admin

Obscurity is a simple but effective security technique. Don‘t make it easy for attackers to find where to attempt logins.

First, change the location and name of the wp-admin directory in your WordPress installation. For example:

/private_admin

This breaks simple heuristics that look for /wp-admin/ and similar patterns.

Next, password protect the directory in your hosting control panel. Add basic authentication requiring a username and password to access.

You can also install plugins like Admin Password Protector to require an additional passcode specifically for the admin side past your WordPress login.

This creates extra hurdles to brute force and guessing admin credentials. Attackers first have to find where the admin is located, then get past two passwords/codes to get access.

3. Use Strong Passwords and Change Them Frequently

Your admin password is the keys to the kingdom. A weak, cracked password renders everything else moot if it allows an attacker full access.

Always use long, extremely complex passwords that are unique for WordPress and other important sites. I recommend starting with 20+ characters as a minimum length.

Include a mix of:

  • Uppercase and lowercase letters
  • Numbers
  • Symbols
  • Avoid real words and phrases

You can also have a password manager like 1Password generate and remember strong, random passwords for you.

In addition to complex passwords, change them frequently:

  • At minimum, once per quarter
  • Whenever there are security concerns
  • When bringing on new team members
  • After any compromise or suspected breach

Regular rotations greatly limit how long a cracked password remains usable to get into your admin side.

4. Require Two-Factor Authentication

Two-factor authentication (2FA) adds an extra layer that requires not just your password, but a secondary code from an authenticator app or SMS text message.

Without that second factor, it‘s virtually impossible for someone to access your account even if they have the password.

There are plugins like Duo Security or Google Authenticator that integrate this easily with WordPress.

Once enabled, after entering your password, you‘ll be prompted for the special rotating 2FA code from your mobile device.

Google Authenticator 2FA code example

I recommend getting a dedicated authenticator app like Authy or Google Authenticator. SMS codes can be more easily compromised.

With 2FA, a leaked password by itself has no value to get into your site. This single security step does wonders to protect against unauthorized logins.

5. Limit Login Attempts and Lock Out Intruders

Brute force attacks that try to guess passwords through repeated login attempts are common. Limit how many times someone can try to log in before being banned.

Plugins like Limit Login Attempts allow configuring how many failures are allowed and duration of the ban.

Start by limiting to 3-5 failed attempts, temporary 15 minute ban. This prevents brute forcing passwords but doesn‘t lock out real users for too long if they happen to mistype their credentials.

Have the ban duration exponentially increase with repeated violations. Slow down or fully block attackers abusing the login form.

You can also selectively whitelist trusted IP addresses used by your own team to exempt them from lockouts.

Aggressive login limiting greatly hinders the potential for credential stuffing and guessing weak passwords. It stops automated attacks in their tracks.

6. Use IP Access Control for WP Admin

Restrict admin access to only your own IP address or addresses to substantially limit attack surface.

Add this sample .htaccess rule to permit access only from specified IPs:

order deny,allow  
deny from all
allow from 192.168.1.101
allow from 192.168.1.102

Here we whitelist IPs 192.168.1.101 and 192.168.1.102 to be able to reach wp-admin. All other IPs are denied.

This prevents remote access for brute force attacks, even if a password is compromised. The attacker would need access to one of the designated internal IPs to log in.

You can automate and manage this with IP whitelisting plugins such as iThemes Security as well.

7. Disable WordPress File Editing in Admin

Editing plugin and theme code files directly from the WordPress admin is risky and can be abused by hackers.

Disable file editing capabilities for all users (except server admins through SFTP) to prevent backdoor trojans and malicious code injection.

Uncheck the box labeled "Disable file editing" under Settings > General in the admin dashboard:

Disable file editing option in wp-admin

Additionally, make sure your wp-config.php file has:

define( ‘DISALLOW_FILE_EDIT‘, true );

This hardens security by forcing code changes to go through proper version control channels like Git and restricts manipulation of files from the admin side.

8. Use Principle of Least Privilege For Users

Give each user account the absolute minimum capabilities and permissions they need. Avoid blanket admin roles.

Review regularly and revoke any unneeded privileges. Just because a user may have needed post editing access in the past does not mean they still require it today.

Plugin developers should have no admin or editing capabilities on a live production site at all. Restrict demo or staging environments for them to test with.

Extra capabilities beyond actual needs open more doors for abuse if a user account is compromised. Treat admin powers as a privilege that must be earned and narrowly scoped.

9. Regularly Audit Activity Logging

Keep a close eye on your users, content changes, configuration edits and any other site activity through logging.

The built-in WordPress activity log shows when users login, make edits, and major configuration changes.

There are also logging plugins such as WP Security Audit Log that expand monitoring for detailed forensic auditing.

Review logs daily to catch unauthorized access attempts and malicious actions quickly. The faster you respond to suspicious activity, the less damage can be done.

Make sure users know their admin activity is being monitored as a deterrent as well.

10. Avoid Plugin Sprawl

Each plugin installed increases your attack surface and vulnerability footprint. More plugins means more code and more potential security holes.

Many compromised sites are exploited not through WordPress itself, but vulnerable plugins with gaps.

Only install reputable plugins from the official WordPress directory. Avoid nulled or pirated plugins which can contain intentional backdoors.

Regularly audit the plugins in use – remove any that are outdated, abandoned by the developer, or no longer needed.

11. Automatically Patch and Update Everything

Outdated WordPress sites are low hanging fruit for attackers to target. New releases fix security issues, so running the latest versions of WordPress core, plugins and themes is critical.

I highly recommend enabling automatic background updates to stay on top of patches:

define( ‘WP_AUTO_UPDATE_CORE‘, true );

This will automatically apply core WordPress updates to fix vulnerabilities without site owner intervention.

Manage plugins and themes with update managers such as WordPress Automatic Updater for a one-click update process.

Bad actors scan constantly for sites lagging on updates. Don‘t make yourself an easy target.

12. Install a Security-Focused Managed Host

Effective security requires an end-to-end approach spanning your WordPress site, web server, database and networks.

Trying to manage hardening all those layers yourself across multiple servers is challenging even for experts. That‘s where managed WordPress hosts that specialize in security come in.

For example, WPEngine proactively monitors and locks down the stack against intrusions. Some of the protections include:

  • Web application firewall
  • DDoS mitigation
  • Regular patching and updates
  • Server-level IP blocking
  • Malware detection and removal
  • Rolling backups with 1-click restore

With hardened hosts, you gain robust security protections without needing the in-house expertise. Your site is sheltered from attacks out of your control.

13. Install a Website Firewall Plugin

As covered earlier, a WAF should be your first line of defense. If using shared hosting without a server firewall, install a plugin version such as Wordfence.

The firewall rules in Wordfence scan traffic to block:

  • Known malicious IPs
  • Botnets
  • Fake Google crawlers
  • Zero-day exploits and vulnerabilities
  • Common attack patterns

For example, if a particular IP address is repeatedly trying to breach WordPress sites, the firewall will block them instantly.

Wordfence constantly monitors attack signatures and updates firewall rules. This identifies and stops new hacking techniques until you can patch.

14. Disable XML-RPC When Not Needed

The XML-RPC functionality in WordPress allows remote access via API. This is required for some functions like mobile apps connecting to your site.

But if you don‘t use XML-RPC, disable it as it opens an extra attack vector. Adding this to wp-config.php disables it:

add_filter( ‘xmlrpc_enabled‘, ‘__return_false‘ );

Hackers can send malicious XML-RPC requests to compromise sites. If you don‘t rely on it for remote API access, shut it down.

15. Hide Error Messages from Users

When login failures or site problems occur, WordPress may reveal specific errors with messages like "incorrect password" or reference codes.

These can provide clues for hackers to refine their attacks, such as determining if they have a valid username and only lack the password.

You can customize error handling to not expose these details. For example, adjusting wp-login.php to return generic errors like:

return new WP_Error( ‘error‘, "Something went wrong, please try again." );

Remove any information that makes hacking attempts easier. Never expose technical error messages to public users.

Protect Your Admin – Coronavirus Mask Not Required!

Securing your WordPress dashboard and wp-admin area takes diligence, but pays dividends in protecting your site from compromise.

Attackers are working overtime trying to breach sites through admin areas, outdated software, and other vulnerabilities.

Implementing these advanced security tips will help keep your site‘s "mask" on to ward off unwanted intruders. Your visitors will never know of the dangers lurking right below the surface.

Stay safe out there on the web! Let me know if you have any other questions.

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.