Home » Security » Comment and Contact Form Spam: Stop Bots Without Annoying Real Visitors
Comment and Contact Form Spam: Stop Bots Without Annoying Real Visitors
Put a form on the internet and bots will find it. Contact forms fill with SEO offers and phishing links, comment sections fill with gibberish and casino URLs, and sign-up forms create fake accounts. Beyond the annoyance, form spam can get your mail server flagged, publish malicious links under your name, and bury real enquiries.
No single trick stops all of it. A few layers together stop nearly all.
Step 1: add a honeypot field
A honeypot is an extra form field hidden from humans with CSS. People never fill it in; simple bots fill in every field they find. Any submission with the hidden field filled is discarded.
<div style="position:absolute;left:-9999px" aria-hidden="true">
<label>Leave this empty <input type="text" name="website_url" tabindex="-1" autocomplete="off"></label>
</div>
Most form plugins (Contact Form 7 with an add-on, WPForms, Gravity Forms, Fluent Forms) have a honeypot setting. It is invisible to real users and costs nothing.
Step 2: add a challenge
For the bots that get past the honeypot, add a challenge that runs in the browser:
| Option | Notes |
|---|---|
| Cloudflare Turnstile | Free, usually invisible, no image puzzles |
| Google reCAPTCHA v3 | Invisible score-based check; v2 shows the checkbox |
| hCaptcha | Privacy-focused alternative to reCAPTCHA |
Always verify the token on the server. A check done only in JavaScript is skipped by any bot that posts directly to your form handler. Mention the service in your privacy policy, since it processes visitor data.
Step 3: validate on the server
Reject submissions that no human would send:
- Messages containing many links, or links in the name field.
- Forms submitted within one or two seconds of the page loading.
- Empty or obviously fake required fields.
- Repeated submissions from the same IP in a short window (rate limiting).
Step 4: tighten comment settings
In WordPress, Settings → Discussion:
- Require name and email.
- Hold comments with more than one link for moderation.
- Hold a comment for moderation unless the author has an approved comment already.
- Close comments on posts older than a set number of days.
Add an anti-spam plugin such as Akismet or Antispam Bee to filter what remains. If you do not need comments, disable them sitewide.
Step 5: protect your email reputation
If your contact form sends an auto-reply to the address in the form, spammers can use it to send mail to anyone through your server. Turn off auto-replies, or only send them after the submission passes spam checks. Also make sure form emails come from an address on your own domain with proper SPF, as covered in SPF record missing, and set the visitor's address as Reply-To instead.
Step 6: test with a real message
After adding protections, submit the form yourself from a normal browser, and from a phone. Confirm the message arrives. Over-zealous filters that block real customers are worse than spam.
Common mistakes
- Adding a CAPTCHA widget but never verifying the response on the server.
- Sending auto-replies to unverified addresses.
- Leaving old, unused forms (newsletter, quote request) unprotected.
- Using the visitor's email as the "From" address, which fails SPF and lands in spam.
Frequently Asked Questions
Why do bots spam small websites nobody visits?
Bots do not choose sites by popularity. They crawl the web looking for any form, then submit links in bulk hoping some will be published or emailed onward. A new site with a form is found within days.
Is a CAPTCHA enough on its own?
It stops most simple bots, but some services solve CAPTCHAs cheaply. Combine it with a honeypot field, server-side checks and rate limits.
Should I turn comments off completely?
If comments add little to your site, yes. It removes the spam problem entirely. If you want discussion, keep them with moderation and spam filtering.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.