Security · Guide
How to Block Bad Bots in WordPress
Short answer
Block bad bots at the edge with Cloudflare Bot Fight Mode, which is free and challenges requests that match known bot patterns, then add Wordfence rate limiting inside WordPress to throttle anything that gets through. Use robots.txt only for polite crawlers, since bad bots ignore it, and check your traffic logs first so you block the bots that are actually hitting your site.
Key takeaways
- Bot Fight Mode is free on every Cloudflare plan and challenges requests that match known bot patterns.
- Bad bots ignore robots.txt, so it can only slow down polite crawlers such as Googlebot.
- Wordfence rate limiting ships with no limits by default, so you must set the limits yourself.
- Block login bots at wp-login.php first, since password guessing is the most common bot attack.
- Always allow verified search engine bots, or your pages can drop out of search results.
What counts as a bad bot?
A bad bot is an automated visitor that harms your site, such as a scraper copying content, a spam bot posting links, or a login bot guessing passwords.
Good bots help you. Search engine crawlers such as Googlebot read your pages so they can appear in search results, and uptime monitors check that your site is online. The goal is to block the harmful bots while letting the helpful ones through.
Bad bots cost real money. They eat bandwidth, fill server logs, slow the site for real visitors, and can trigger hosting limits. On a small site, one aggressive scraper can push a shared hosting account toward its CPU or bandwidth limits.
How do you tell bot traffic from real visitors?
Look for bursts of requests from one IP address, odd user-agents, and hits on pages no human visits, such as wp-login.php and xmlrpc.php.
Open your traffic log first. Wordfence Live Traffic shows each request with its type, so you can filter for bots that tried to log in. Cloudflare Security Analytics shows bot events in its Events tab, so you do not have to guess from raw logs.
Check the user-agent, but do not trust it alone. Any bot can claim to be Googlebot in its user-agent string. Verify search engine bots with a reverse DNS lookup or against Google's published IP ranges (Verifying Googlebot).
How do you block bad bots with Cloudflare Bot Fight Mode?
Turn on Bot Fight Mode in Cloudflare, and it challenges requests that match known bot patterns across your whole domain.
Bot Fight Mode is included with Free plans. When enabled, it identifies traffic matching patterns of known bots and issues computationally expensive challenges in response (Bot Fight Mode).
- In the Cloudflare dashboard, go to the “Security Settings” page.
- Filter by “Bot traffic”.
- Go to “Bot fight mode”.
- Turn “Bot fight mode” on.
| Method | Where it runs | Cost | Best for |
|---|---|---|---|
| Cloudflare Bot Fight Mode | At the edge, before WordPress loads | Free | Known bad bots across the whole site |
| Super Bot Fight Mode | At the edge | Pro plan and above | Granular control with exceptions |
| Wordfence rate limiting | Inside WordPress | Free plugin | Throttling crawlers and login attempts |
| robots.txt | Read by crawlers | Free | Polite crawlers only |
| IP or user-agent block | Firewall or server | Free | One repeat offender |
Kinsta notes that the free Cloudflare plan offers Bot Fight Mode plus JavaScript and managed challenges to reduce unwanted bot traffic (Kinsta).
You cannot tune Bot Fight Mode. It cannot be customized, adjusted, or reconfigured via custom rules, and it cannot be bypassed with custom rule Skip actions (Bot Fight Mode).
Check that it is working in Security > Analytics. Go to the Events tab, and any requests challenged by this product will be labeled “Bot Fight Mode” in the Service field (Bot Fight Mode).
If your site is not on Cloudflare yet, start with our guide to set up Cloudflare for WordPress.
What does Super Bot Fight Mode add?
Super Bot Fight Mode adds granular control, so you can challenge or block bots and create exceptions for traffic you want to allow.
Super Bot Fight Mode is available on Pro, Business, and Enterprise plans, and it runs on the Ruleset Engine, so it supports Skip rules (Stop malicious bots).
The paid tiers let you treat bot scores differently. Cloudflare suggests a Managed Challenge for traffic scored “definitely automated” and “likely automated”, and Allow for “verified bots” (Stop malicious bots).
Upgrade when the free toggle causes false positives. Bot Fight Mode may challenge API or mobile app traffic, and the only fixes are to turn it off or upgrade (Bot Fight Mode).
For AI crawlers specifically, see how to block AI crawlers in WordPress, since those need a different rule from generic bad bots.
How do you block bad bots with Wordfence rate limiting?
Turn on Wordfence rate limiting and set request limits, so any IP that asks for too much too fast gets throttled or blocked.
Wordfence ships with rate limiting set to unlimited, so it does nothing until you set limits. Wordfence staff suggest starting with 240 requests per minute for any visitor, 120 page views per minute for crawlers, and 60 crawler 404s per minute, throttling rather than blocking (Recommended Rate Limiting Settings).
Set the human limits to match. The same staff values are 120 page views per minute for humans, 60 human 404s per minute, and a 30-minute block when an IP breaks a rule (Recommended Rate Limiting Settings).
- Go to “Wordfence > Firewall > Rate Limiting” in your dashboard.
- Turn on “Enable Rate Limiting and Advanced Blocking”.
- Set “Verified Google crawlers will not be rate-limited” so search engines keep crawling.
- Enter the limits above and save.
Throttling is safer than blocking for crawlers. Wordfence staff note that throttling is generally better than blocking with crawlers, because a good search engine understands what happened if it is mistakenly throttled (Recommended Rate Limiting Settings).
If rate limiting starts blocking real visitors, read how to fix the 429 Too Many Requests error before you raise the limits.
Can robots.txt block bad bots?
No, robots.txt cannot block bad bots, since it only asks crawlers to stay away and bad bots ignore it.
A robots.txt file tells search engine crawlers which URLs they can access on your site, mainly to avoid overloading your site with requests. Google states that it is not a mechanism for keeping a web page out of Google (Robots.txt Introduction).
Google also warns that robots.txt rules may not be supported by all search engines, and the instructions cannot enforce crawler behavior. While Googlebot and other respectable crawlers obey the file, other crawlers might not (Robots.txt Introduction).
Use robots.txt for polite crawlers only, and block bad bots at the firewall instead. A short Disallow rule for a search engine bot is fine, but it is a request, not a lock.
User-agent: GPTBot
Disallow: /
How do you block a single bot or IP address?
Block one IP address or user-agent in your firewall, and check the logs a few days later to see whether the bot moved to a new address.
In Cloudflare, create a WAF custom rule that blocks the offending IP address or user-agent string. In Wordfence, use the Blocking page to block an IP, or block it from Live Traffic after you spot it (Automatic ban bad users).
Do not build a long manual block list. Wordfence advises that permanently blocking IPs is generally an ineffective strategy, since bots rotate addresses, and it takes up your time (Automatic ban bad users).
For a full firewall setup, see our Cloudflare WAF rules for WordPress.
How do you protect wp-login.php from login bots?
Protect wp-login.php with brute-force limits, so repeated failed logins lock the attacker out before they guess a password.
Wordfence staff recommend 3 to 5 login attempts and password resets, counted over 4 hours, with a lockout of 30 minutes or longer (Recommended Rate Limiting Settings).
Add a second layer at the edge. Cloudflare suggests a Managed Challenge for login paths, and its account-takeover guide pairs bot protection with Turnstile on the login form (Stop account takeover attacks).
Use strong, unique passwords and two-factor login for every admin account. A bot that guesses a weak password needs only one lucky try, so limits alone are not enough.
For the full setup, see how to set up the Wordfence firewall.
What mistakes should you avoid?
Do not block bots by user-agent alone, since any bot can copy the user-agent of a real browser or Googlebot.
- Blocking all bots, including Googlebot, which can remove your pages from search results.
- Setting rate limits so low that real visitors get throttled during busy hours.
- Relying on robots.txt to stop scrapers, since bad bots ignore it.
- Permanently blocking single IPs one by one, which wastes time while bots rotate addresses.
- Turning on bot protection and never checking the logs to see what it blocked.
Check what you blocked every week. Open Cloudflare Security Analytics or Wordfence Live Traffic, look for real visitors in the blocked list, and loosen the rule that caught them.
Frequently asked questions
Will blocking bots hurt my SEO?
No, if you allow verified search engine bots. Cloudflare lets you allow verified bots while challenging automated traffic, and Wordfence has a setting so verified Google crawlers are not rate-limited. The risk comes from blocking Googlebot by mistake, so check your blocked list for search engine IPs after any change.
How can I tell if bots are slowing down my site?
Look for high CPU use, slow page loads, and bursts of requests from a few IP addresses in your traffic logs. Cloudflare Security Analytics and Wordfence Live Traffic both show bot requests and how often they hit your site. If bot requests outnumber human visits during quiet hours, bots are likely the cause.
Does Cloudflare Bot Fight Mode block Googlebot?
No. Bot Fight Mode targets traffic that matches known bot patterns, and Super Bot Fight Mode lets you allow verified bots outright. If a real crawler is challenged by mistake, turn off Bot Fight Mode or upgrade to Super Bot Fight Mode, which supports exception rules for traffic you want to allow.
Can I block bots without Cloudflare?
Yes. Wordfence rate limiting and brute-force protection run inside WordPress and need no CDN. Your host firewall can also block IPs, and a robots.txt file can slow down polite crawlers. Edge blocking is stronger, since it stops bots before WordPress loads, but plugin-level limits still help.
Why do bots keep coming back after I block them?
Bots rotate IP addresses and user-agents, so blocking one address only stops that address. Rate limiting and edge challenges work better than manual IP blocks, because they judge each request on its behavior. Keep your limits on and review the logs, rather than chasing each new address by hand.
Sources
- Bot Fight Mode Cloudflare Developers
- Stop malicious bots while allowing legitimate traffic Cloudflare Developers
- Stop account takeover attacks Cloudflare Developers
- Recommended Rate Limiting Settings? WordPress.org
- Robots.txt Introduction and Guide Google Search Central
- Verifying Googlebot Google Search Central
- Protect WordPress site from bot traffic with Cloudflare Kinsta
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
