Skip to content
Antisy

Protect WPForms from bots, with no puzzle

To protect WPForms (Lite version) with Antisy: one tag in the page, then the wpforms_process_initial_errors filter on the server. Antisy’s script adds the antisy-token field to the AJAX submission, and the filter reads it in $_POST to ask for a verdict. Tried on 9 November 2026 with WPForms Lite 2.0.4, in WordPress 7.1.4.

As of .

How WPForms sends the form

WPForms sends the form by AJAX to admin-ajax.php, from the submit event: Antisy’s script adds the antisy-token field there, as for an ordinary form.

The hook to set

The wpforms_process_initial_errors filter receives the errors before the entry is saved. An error set under the header key stops the submission and is shown above the form. antisy_verdict is the function of the documentation, described in the WordPress guide.

antisy-formulaires.php
// WPForms: the wpforms_process_initial_errors filter receives the errors before the entry is saved; a “header” error stops the submission.
add_filter('wpforms_process_initial_errors', function ($errors, $form_data) {
    if (!empty($errors[$form_data['id']])) {
        return $errors; // the form is already refused: no call to Antisy
    }
    if (antisy_verdict($_POST['antisy-token'] ?? '') !== 'allow') {
        $errors[$form_data['id']]['header'] = 'Submission refused.';
    }
    return $errors;
}, 10, 2);

What a refused visitor sees

WPForms answers 200 with success set to false: no entry is saved, and the text of the error is the one you write, here a generic refusal.

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, WPForms Lite 2.0.4, form sent by AJAX, the default setting): 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. Not tried: WPForms with AJAX sending turned off, 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