WordPress

How to Prevent Brute Force Attacks on Your WordPress Site

By jm1CotMAha
March 3, 2025
7 min read
How to Prevent Brute Force Attacks on Your WordPress Site

Introduction

Today I am going to talk about WordPress security.Β  Recently I have been busy fixing hacked WordPress sites so Let me talk about brute force attacks. Brute force attacks are one of the most common threats to WordPress websites. These attacks involve hackers systematically guessing usernames and passwords until they gain access. Since WordPress powers over 40% of websites on the internet, it’s a prime target for cybercriminals. A single successful brute force attack can lead to stolen data, site defacement, or complete takeover.

To protect your WordPress site, you need a solid security strategy. I'll cover what brute force attacks are, how they work, and the best methods to prevent them.

1. What is a Brute Force Attack?

A. How Brute Force Attacks Work

βœ… Attackers use automated bots to repeatedly guess username-password combinations. βœ… They exploit weak passwords and common login credentials. βœ… The attack continues until they successfully log in or get blocked.

B. Types of Brute Force Attacks

βœ… Simple Brute Force Attack: Tries every possible password combination. βœ… Dictionary Attack: Uses a list of common passwords (e.g., β€œpassword123,” β€œadmin,” β€œ123456”). βœ… Reverse Brute Force Attack: Uses a single password against many usernames. βœ… Credential Stuffing: Uses leaked username-password pairs from data breaches. I recommend password savers like Last Pass. The reason behind this is I can set a 25 character password and it's different for every site.

<img class="wp-image-987505891 aligncenter size-full" src="https://

C. Why WordPress is a Target

βœ… WordPress’s popularity makes it attractive to hackers. βœ… Many users fail to update passwords or security settings. βœ… Default login pages (e.g., /wp-login.php) are easy to find. Try setting your login page to a childhood memory or something you can remember but no one else will guess.

2. Signs Your WordPress Site is Under a Brute Force Attack

A. Increased Login Attempts

βœ… Multiple failed login attempts from different IPs. βœ… Unusual spikes in server resource usage.

B. Locked Out of WordPress Admin

βœ… If hackers guess your password, you might be locked out of your own site. βœ… Unusual new admin accounts may appear.

C. Server Slowdowns or Downtime

βœ… Continuous login attempts can slow down or crash your site. βœ… High CPU usage in your hosting dashboard could be a red flag.

3. How to Prevent Brute Force Attacks on WordPress

A. Strengthen Your Login Credentials

βœ… Use long, complex passwords with letters, numbers, and symbols. βœ… Avoid common usernames like β€œadmin” or β€œwebmaster”. βœ… Consider using passphrases instead of traditional passwords.

B. Enable Two-Factor Authentication (2FA)

βœ… Requires a second verification step (e.g., SMS or authenticator app). βœ… Even if attackers guess your password, they can’t log in without the second factor. βœ… Plugins like Google Authenticator, Authy, or Wordfence Login Security can help. I cannot stress this enough. Yes, it's a pain to enter these codes everytime you want to login, but it will save you tons of grief down the road. so it's well worth it.

C. Limit Login Attempts

βœ… Install security plugins like Limit Login Attempts Reloaded or WP Cerber. βœ… Restrict failed login attempts to 3-5 per IP before temporary lockout. βœ… Helps prevent bots from repeatedly trying passwords. I have it set to 2.Β  You get 2 attempts before you are permanently banned.

D. Change the Default Login URL

βœ… Move the WordPress login page from /wp-admin or /wp-login.php. βœ… Plugins like WPS Hide Login or iThemes Security can do this. βœ… Prevents automated bots from easily finding the login page.Β  If you are like me, plugins cause bloat.Β  Here is how to code it yourself.

  • Add constant to wp-config.php

define('WP_ADMIN_DIR', 'secret-folder');
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);
  • Add below filter to functions.php
add_filter('site_url',  'wpadmin_filter', 10, 3);

function wpadmin_filter( $url, $path, $orig_scheme ) {
$old = array( "/(wp-admin)/");
$admin_dir = WP_ADMIN_DIR;
$new = array($admin_dir);
return preg_replace( $old, $new, $url, 1);
}
  • Add below line to .htaccess file

RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]

Easy, huh? just replace secret-folder with anything you want. Remember secret folder is listed twice. These must match in order to work.

E. Use a CAPTCHA on Login Pages

βœ… Google reCAPTCHA blocks bot traffic while allowing real users. βœ… Protects against automated brute force attacks. βœ… Popular plugins: reCaptcha by BestWebSoft, hCaptcha, and Login No Captcha reCAPTCHA.

F. Implement IP Blacklisting & Geoblocking

βœ… Block known malicious IP addresses using Wordfence or Sucuri. βœ… Restrict access from countries where you don’t expect login attempts. βœ… Works well for local businesses that don’t need global access.

G. Enable Multi-User Role Restrictions

βœ… Give users only necessary permissions (avoid giving admin access to everyone). βœ… Require strong passwords for all accounts, not just admins. βœ… Use security monitoring tools to track suspicious user activity.

H. Install a WordPress Security Plugin

βœ… Plugins like Wordfence, Sucuri Security, iThemes Security, and MalCare provide multiple layers of protection. βœ… Features include firewalls, malware scanning, and brute force prevention.

I. Secure Your Hosting & Server

βœ… Use managed WordPress hosting with built-in security (e.g., Kinsta, WP Engine, SiteGround). βœ… Regularly update PHP versions and use SSL encryption. βœ… Set up a web application firewall (WAF) to filter bad traffic.

<img class="wp-image-987505892 aligncenter size-full" src="https://

Β 

4. How to Recover from a Brute Force Attack

A. Regain Admin Access

βœ… If locked out, reset the password via phpMyAdmin or FTP. βœ… Check for new suspicious admin users and remove them.

B. Restore a Clean Backup

βœ… If hackers gained access, restore your website from a recent backup. βœ… Ensure backups are stored offsite or on cloud services. βœ… Popular backup plugins: UpdraftPlus, Jetpack Backup, BlogVault.

C. Scan for Malware & Remove Suspicious Files

βœ… Use security plugins to scan for injected malicious code. βœ… Delete unknown scripts from wp-content/uploads, themes, and plugins. βœ… If unsure, consult a WordPress security expert.

5. Long-Term WordPress Security Best Practices

A. Keep WordPress Core, Plugins & Themes Updated

βœ… Regular updates fix vulnerabilities that hackers exploit. βœ… Enable auto-updates for security patches when possible.

B. Use a Firewall & DDoS Protection

βœ… Web Application Firewalls (WAF) block malicious traffic before it reaches your site. βœ… Cloudflare and Sucuri offer real-time threat monitoring and DDoS protection.

C. Schedule Regular Security Audits

βœ… Perform security scans weekly or monthly. βœ… Review login activity and failed login attempts. βœ… Identify vulnerabilities before attackers exploit them.βœ… Buy my website maintenance package and let me deal with it.

Final Thoughts

Brute force attacks remain a major cybersecurity threat, but proactive security measures can significantly reduce risks. By strengthening login credentials, enabling 2FA, limiting login attempts, and using security plugins, you can keep your WordPress site safe from hackers.

Cyber threats are constantly evolving, so maintaining a strong security posture is essential. Start implementing these security strategies today to safeguard your WordPress site from brute force attacks!

πŸ“§ Stay Updated

Get the latest web development tips and insights delivered to your inbox.

β˜• Support Our Work

Enjoyed this article? Buy us a coffee to keep the content coming!

β˜•Buy me a coffee

About the Author

Brian Keary

Brian Keary

Founder & Lead Developer

Brian is the founder of BKThemes with over 20 years of experience in web development. He specializes in WordPress, Shopify, and SEO optimization. A proud alumnus of the University of Wisconsin-Green Bay, Brian has been creating exceptional digital solutions since 2003.

Expertise

WordPress DevelopmentShopify DevelopmentSEO OptimizationE-commerceWeb Performance

Writing since 2003

Tags

#brute force attack#cybersecurity best practices#firewall for wordpress#limit login attempts#malware protection#secure wordpress login#site hacking prevention#two-factor authentication#web application firewall#wordpress brute force protection#wordpress hosting security#wordpress password security#wordpress security#wordpress security plugins#wp security tips

Share this article

Enjoyed this article?

Subscribe to our newsletter for more insights on web development and SEO.

Let's Work Together

Use the form to the right to contact us. We look forward to learning more about you, your organization, and how we can help you achieve even greater success.

Trusted Partner

BKThemes 5-stars on DesignRush
Contact Form
How to Prevent Brute Force Attacks on Your WordPress Site