How to Stop the Facebook Bot from Crashing Your WordPress Website

Ghost bots attacking a website hosting server We had a panicked call from a client who had just done a lot of updates to their website and had launched a campaign promoting their products. Their website was extremely slow, crashed at times and was throwing up errors. The admin area felt like it was stuck in wet cement. They sell high value products costing up to $2 million each, so the loss of website visits had the potential to be extremely costly.

GET SLOW WEBSITE HELP

Because they had been doing the work on the website themselves and had installed a number of plugins that we wouldn’t normally use, it seemed likely that there was a conflict somewhere that was slowing everything down. The normal test is to turn plugins off until the website starts working to find what is causing the conflict. We also increased server resources, which seemed to fix the problem at the time. But the next morning, the website was crashing again.

Other websites on the same server had no issues, so this problem was restricted to this website – and it turned out to be Facebook causing the issue.

Four Concepts Worth Knowing First

You don’t need to be technical to follow this guide, but these four ideas will make everything click:

  • PHP (The Chef): Every time a visitor – or a bot – clicks a link, they place an “order.” PHP is the Chef who finds the ingredients (your product data) and cooks the page from scratch.
  • CPU Usage (The Engine): Your server is like a car engine. Loading a simple page is idling. Running a complex product search is flooring it up a steep hill. At 100% CPU, the engine is redlining and eventually stalls.
  • The .htaccess File (The Security Guard): A file that sits outside your kitchen. Before anyone can talk to the Chef, they must pass the Guard. The Guard can reject bad orders before they ever waste the Chef’s time.
  • WP-Cron (The Chore List): WordPress runs automated background tasks – sending emails, checking for updates – every time a visitor arrives. If 50 bots arrive in one second, WordPress tries to run those chores 50 times simultaneously.

The slow website mystery

The dashboard takes a minute to load. Images aren’t appearing. Customers may be seeing the “503 Service Unavailable” error page.

You look for the obvious culprit – a spike in real traffic. But analytics show only a handful of people on the site.

This is the Silent Redline: your server’s engine is screaming at maximum capacity with no one in the driver’s seat.

The Usual Suspects Don’t Fit

Standard troubleshooting gets you nowhere:

  • Deactivating plugins – CPU stays pinned.
  • Clearing the cache – usage remains at the ceiling.
  • Upgrading your hosting plan – the bot simply devours the extra capacity too.

The Real Culprit: The Bot Bomb

The true cause is often hiding in your server logs under an innocent-sounding name: meta-externalagent or facebookexternalhit.

This is the Meta Crawler – Facebook’s automated robot. Its normal job is to visit your site so that when someone shares your link on Facebook or Instagram, a preview image and description appear. Under ordinary circumstances, it’s a helpful visitor.

But thanks to a quirk in how modern e-commerce sites work, this bot can accidentally turn into a self-inflicted denial-of-service attack.

The Detective Work: How We Found the Culprit

Identifying a “Bot Bomb” requires looking past the surface of your website and into the server’s raw data. If you think you may have the same problem, here is how you identify it using cPanel.

1. The Resource Usage Monitor

  • Where we looked: The “Resource Usage” or “CPU and Concurrent Connection Usage” icon in cPanel.
  • What we found: We looked at the CPU Graph. It showed a sustained line at 100%, but the Entry Processes (EP), which represent how many different people are on the site, were very low.
  • Conclusion: This proved it wasn’t a “crowd” of people, but rather one or two extremely “heavy” tasks (like a complex product search) that were hogging all the power.

2. The Raw Access Logs (The Fingerprints)

  • Where we looked: The “Visitors” or “Raw Access Logs” section.
  • What we found: We looked at the User Agent and Request URL columns. We saw dozens of requests happening at the exact same time from a visitor named meta-externalagent.
  • Conclusion: These bots weren’t looking at normal pages; they were hitting the robots.txt file with hundreds of requests and overwhelming the website.

3. The File Manager (The Ghost File)

  • Where we looked: The File Manager inside the public_html folder.
  • What we found: We searched robots.txt but it was missing from the folder, even though we could see it when we typed the address into a browser.
  • Conclusion: This shows that the site was using a “Virtual” file. WordPress was “cooking” this file from scratch every time a bot asked for it. By creating a physical file, we saved the server from having to do that extra work hundreds of times a minute. However, the access logs then showed that the bot was trying to index every possible product combination at once.

4. The Terminal (Real-Time Heartbeat)

  • Where we looked: The Terminal icon (SSH).
  • What we found: We ran a command called top -c. This showed us exactly which “files” were currently eating the CPU.
  • Conclusion: We saw multiple lines of index.php and wp-cron.php running simultaneously. This showed that the bot hits were triggering a “chain reaction” of background tasks that the server couldn’t keep up with.

Why This Happens – The Filter Trap

The irony is that it was probably the updates the client did that triggered the Facebook bot to show more interest in their website and “re-spider” all the pages, including all the variations on products in their online shop.  The Facebook bot was giving the website too much love!

The Infinite URL Problem

On a website with product filters and multiple options that let customers narrow results by things like height, weight, colour etc, to a human user, selecting two filters feels like one action. To a bot, every combination of filters creates a unique, brand-new web address (URL):

  • yoursite.com/products/ – easy
  • yoursite.com/products/?filter_weight=2kg – harder
  • yoursite.com/products/?filter_weight=2kg&filter_length=2m&colour=blue – very hard

The Facebook bot doesn’t understand these are just filters on the same products. It sees thousands of “new” pages it hasn’t indexed yet and decides to crawl all of them – simultaneously.

Why Filtered Pages Are Expensive

Every time the bot hits one of those filtered URLs, the website must:

  1. Search through every product in the database
  2. Check each product’s weight attribute
  3. Check each product’s length attribute
  4. Check each product’s colour attribute
  5. Calculate which products match all filters
  6. Build a custom page to display the results

When a human does this once, the server barely notices. When a bot fires off 50 of these requests in a single second across 10 different filter combinations, the website collapses under the load.

The Cron Death Spiral

This is compounded by a WordPress feature called WP-Cron. By default, WordPress checks its chore list (sending emails, running updates) every time a visitor arrives. When the bot hammers your site with complex filter requests, WordPress responds by triggering its chore list hundreds of times per minute – on top of an already-overwhelmed hosting server.

The result: the server is so busy starting new chores and calculating complex searches that it has no capacity left to serve actual customers.

The Detective Work – Confirming the Culprit

Before changing any settings, you need to see the evidence. Here’s where to look.

1. The Live View (The Smoking Gun)

If your hosting gives you SSH/Terminal access, the command top -c shows everything the server is currently processing. In a bot bomb scenario, you’ll see a long list of entries like:

lsphp:/home/username/public_html/index.php
lsphp:/home/username/public_html/index.php
lsphp:/home/username/public_html/index.php

Ten or twenty of these running simultaneously confirms the server is being flooded. If wp-cron.php appears repeatedly, the Cron Death Spiral is also in play.

2. The Visitor Logs (Following the Footprints)

In cPanel, find the “Visitors” or “Raw Access Logs” section. This is a diary of every person or robot that has touched your site in the last 24 hours.

Look for the User Agent column. Search for:

  • meta-externalagent
  • facebookexternalhit

What a bot attack looks like in the logs:

  • 5-10 requests all happening at the exact same second
  • The same User Agent repeating over and over
  • The requested URL is a long string filled with ?, &, and filter_ symbols rather than a simple page like /about-us/

3. The Virtual Robots.txt Trap

Every website has a robots.txt file (found at yoursite.com/robots.txt) that tells bots where they are and aren’t allowed to go.

In cPanel File Manager, check your public_html folder. If you can see robots.txt by visiting the URL in a browser, but there is no actual file in File Manager, you have a “virtual” robots.txt – WordPress is generating it on the fly using PHP every single time a bot checks it.

If an aggressive bot checks your rules 50 times a second, that’s 50 unnecessary page-cooking requests wasting CPU on something that should be instant.

The Three-Step Fix

Once you’ve confirmed the Meta Crawler is hammering your filtered URLs, work through these three steps in order. The goal is to stop the bot at the front gate before it clogs up PHP.

Step 1: Create a Physical Robots.txt File

Why: If WordPress is virtually generating your robots.txt, every bot check wastes CPU. A physical file is handed over instantly – PHP never wakes up.

How:

  1. Log in to cPanel and open File Manager
  2. Navigate to public_html
  3. Create a new file named exactly robots.txt (all lowercase)
  4. Paste in your rules, including specific blocks for WooCommerce filter URLs. At minimum, include:
User-agent: *
Disallow: /?filter_*
Disallow: /page/*?filter_*

User-agent: facebookexternalhit
Disallow: /?filter_*
Disallow: /page/*?filter_*

User-agent: meta-externalagent
Disallow: /?filter_*
Disallow: /page/*?filter_*
  1. Save the file

Result: Bots get the rules instantly as a plain text file. PHP stays asleep.

Step 2: Add an .htaccess Security Guard

Why: This is the most critical step. Even with a good robots.txt, a misbehaving bot may ignore it. The .htaccess file enforces the block at the server level – WordPress is never involved, making it virtually free in terms of CPU.

How:

  1. In File Manager, enable “Show Hidden Files” in the Settings menu (top right)
  2. Find the .htaccess file in public_html
  3. Right-click → Edit
  4. Add the following block at the very top of the file, before anything else:
# Block Facebook/Meta bots from hitting filtered URLs
RewriteEngine On
RewriteCond %{QUERY_STRING} filter_ [NC]
RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit|meta-externalagent) [NC]
RewriteRule ^ - [F,L]
  1. Save the file

Result: If a request comes in from the Facebook bot AND the URL contains a filter, the server returns a 403 Forbidden and drops the connection immediately – before PHP or WordPress ever see it. This costs almost nothing in CPU.

Step 3: Take Control of WP-Cron

Why: By default, WordPress triggers its background tasks (emails, update checks) on every page request. During a bot attack, this runs hundreds of times per minute. Moving this to a proper scheduled task stops the self-inflicted load.

How – Part A: Disable the default behaviour

  1. In File Manager, find wp-config.php in public_html
  2. Right-click → Edit
  3. Find the line that reads /* That's all, stop editing! Happy publishing. */
  4. Immediately above that line, add:
define('DISABLE_WP_CRON', true);
  1. Save the file

How – Part B: Set up a proper scheduled task

  1. In cPanel, find the “Cron Jobs” icon
  2. Set the frequency to every 10 minutes – select */10 for the minute field, * for all others
  3. Set the command to (replace yourusername with your actual cPanel username):
php -q /home/yourusername/public_html/wp-cron.php >/dev/null 2>&1
  1. Save the cron job

Result: Scheduled tasks (emails, updates, backups) continue to run perfectly – just once every 10 minutes in a controlled way, rather than hundreds of times per second driven by bot traffic.

What to Expect After the Fix

Within minutes of completing all three steps, CPU usage should drop from a flat 100% to a healthy 2-5%. You haven’t lost any functionality, and you haven’t blocked Facebook from previewing your main product pages – you’ve simply stopped an aggressive robot from redlining your engine on pages it was never meant to index.

Long-Term Maintenance

Once the immediate crisis has passed, it’s worth doing some housekeeping to prevent a recurrence.

Delete Unused Plugins (Don’t Just Deactivate)

  • A deactivated plugin isn’t truly gone. Many plugins load their settings into the server’s memory on every single page load, even when switched off. Think of them as heavy boxes of old paperwork left in the middle of the kitchen – PHP has to trip over them every time.
  • Go through your plugin list. If you haven’t used something in the past month and don’t have an immediate plan for it, delete it rather than just deactivating it. This cleans up your database and makes every page load slightly faster.

Consider a CDN with Bot Protection (Cloudflare)

  • The most robust long-term solution is to stop aggressive bots before they ever reach your server. Cloudflare (free tier available) acts like a gatehouse kilometres down the road – if a bot is blocked there, your server never sees the request and your CPU stays at zero.
  • Cloudflare’s Bot Fight Mode specifically targets known bad bots and either challenges or blocks them outright. This is worth setting up once the immediate crisis is resolved.

Check for Database Bloat

If the site still feels a little slow after the bot is dealt with, you may have accumulated database bloat – old data left behind by plugins you’ve long since removed. A plugin called Query Monitor can show you the size of your “Autoloaded Options” in the database. If it’s over 1MB, your server is working too hard just to start up on each page load. A developer can clean this up in under an hour.

In summary…

A slow website is rarely caused by just one thing. In this case, it was an aggressive bot finding a weak spot – the combination of unprotected filter URLs and a virtual robots.txt that wasted CPU on every check.

The three-step fix addresses each layer:

StepWhat It DoesWhere to Do It
Physical robots.txtTells bots the rules instantly, without involving PHPcPanel File Manager
.htaccess GuardBlocks filter requests from Facebook bots at the server gatecPanel File Manager
Disable WP-CronStops background tasks running out of control during bot trafficwp-config.php + cPanel Cron Jobs

Together, these turn your server from an open door into a high-performance machine that reserves its energy for the people who matter most: your customers.