Protect Contact Form 7 from bots, with no puzzle
To protect Contact Form 7 with Antisy: one tag in the page, then the wpcf7_spam filter on the server. Antisy’s script adds the antisy-token field to the submission, and the filter reads it in $_POST to ask for a verdict. Tried on 9 November 2026 with Contact Form 7 6.2.4.1, in WordPress 7.1.4.
As of .
How Contact Form 7 sends the form
Contact Form 7 sends the form with fetch to its REST endpoint, from the submit event. Antisy’s script holds that submission back, adds the hidden antisy-token field and sends it again, as for an ordinary form. The field does not have to be declared in the form: your server reads it in $_POST.
The hook to set
The wpcf7_spam filter is applied once the fields are validated. When it returns true, the submission is classed as spam: the e-mail is not sent. antisy_verdict is the function of the documentation, described in the WordPress guide.
// Contact Form 7: the wpcf7_spam filter returns true when the submission is spam, and the email is not sent.
add_filter('wpcf7_spam', function ($spam) {
if ($spam) {
return $spam; // already classed as spam by Contact Form 7: no call to Antisy
}
return antisy_verdict($_POST['antisy-token'] ?? '') !== 'allow';
});What a refused visitor sees
Contact Form 7 answers 200 with the status spam and the “spam” message of your form, which you set in the Messages tab: leave a generic message, one that does not say why.
What was tried
On 9 November 2026, on a local machine, in a WordPress installed for the occasion (WordPress 7.1.4, PHP 8.3.36, Contact Form 7 6.2.4.1): a submission by a real browser passes, a submission by curl without a token is refused when browser collection is on for the site, and an unreachable Antisy lets the submission through. The API was Antisy’s local laboratory, never production. No e-mail was sent: the installation has no mail server, and Contact Form 7 answers mail_failed, counted here as accepted. Not tried: a page cache or an optimisation plugin, a signed-in visitor, Firefox and Safari, an HTTPS page, other versions of WordPress and of the plugin.
The rest
The tag in the <head>, the antisy_verdict function, the secret and what happens when Antisy does not answer are in the WordPress guide.
See: WordPress guide: the tag, the function, the secret · Documentation: when the API does not answer