A WordPress site running a single anti-spam plugin will catch maybe 90% of spam — which sounds great until volume hits 5,000 attempts a day and the surviving 10% is 500 comments your editorial team has to triage. The defenses that hold up in production are layered: edge, application, content heuristic, and moderation. Each layer catches what the previous one missed, and no layer carries the full load.
What’s happening
Spam comments arrive in three shapes, defeated by three layer types. Volume bots — most of the noise, easiest to stop — drop at the edge before they reach PHP. Distributed residential spam — harder to catch, often AI-generated text now — needs reputation data or heuristic checks that look at the network of senders, not just the individual comment. Human-operated spam farms — lowest volume, hardest to filter — require post-submission moderation.
A defense in depth treats wp-comments-post.php as the last line, not the first. Cloudflare WAF + a challenge widget + a reputation plugin + a moderation workflow catch different segments. Removing any one layer dumps that segment into the next layer’s queue.
How to verify
wp comment list --status=spam --number=100 --fields=comment_ID,comment_author_IP,comment_author_email,comment_date | head -50
wp db query "SELECT comment_author_IP, COUNT(*) FROM wp_comments WHERE comment_approved = 'spam' AND comment_date > DATE_SUB(NOW(), INTERVAL 7 DAY) GROUP BY comment_author_IP ORDER BY 2 DESC LIMIT 20;"
wp db query "SELECT DATE(comment_date), COUNT(*) FROM wp_comments WHERE comment_approved = 'spam' GROUP BY DATE(comment_date) ORDER BY 1 DESC LIMIT 14;"
tail -f /var/log/nginx/example.com.access.log | grep "wp-comments-post"
If 80% of recent spam comes from 10 IPs, you have a volume-bot problem and the edge layer is missing. If it comes from 500 different IPs across the globe, you have distributed spam and you need a reputation service.
The fix
A four-layer stack:
- Edge layer — Cloudflare WAF rule + Turnstile. A rate-limit rule on
/wp-comments-post.php(10 requests per 5 minutes per IP). A Turnstile widget on the comment form. Together they kill volume bots without touching PHP. Free at any volume on Cloudflare’s plan. - Application layer — Antispam Bee or Akismet. Pick one based on data-residency posture. The plugin filters comments that pass the edge layer using heuristics or reputation data. Catches 80-90% of what reaches it.
- Content heuristic layer — moderation rules. In Settings > Discussion, hold comments with more than two URLs, force moderation for unrecognized authors, and add abusive keywords to the blocklist. WordPress has shipped these settings for a decade — most sites never use them.
- Moderation queue and SLA. Whatever survives the first three layers goes to the queue. The editorial team checks it twice a day, mass-marks spam, approves legitimate comments. If the queue is consistently above 50, a layer above is leaking.
- Close comments on old posts. Settings > Discussion > “Automatically close comments on posts older than 30 days” cuts the attack surface by 90% on most sites. Comments on the homepage and recent articles is the entire value; comments on a 2019 post is overhead. Stack Harbor’s enterprise WordPress hosting operating model tunes the comment retention window to match the editorial reality, not the WordPress default.
Stack Harbor’s enterprise WordPress hosting operating model includes the comment defense layering as part of site launch, not as an afterthought. When the moderation queue is consuming the editorial team, start the conversation.