Gravity Forms Spam Protection: A Developer's Guide to Content-Level Filtering
Gravity Forms is the form plugin people reach for when the form actually matters. It runs on more than a million sites, and it is disproportionately the tool behind quote requests, demo bookings, application forms, and multi-step lead capture — the forms that feed a CRM and a sales team. Which is precisely why spam on a Gravity Form is more expensive than spam on a throwaway contact page. It does not just clutter an inbox; it pollutes your pipeline.
Gravity Forms ships with a honeypot option and an anti-spam integration or two, but if you are running it for lead generation, you want something that judges the submission itself. Here is how to do that at the content level.
The Cost of a Fake Lead in Gravity Forms
When a spam submission clears a contact page, you delete an email. When one clears a lead form wired into your CRM, it creates a record. That record triggers automation, gets assigned to a rep, enters your reporting, and quietly distorts your cost-per-lead maths. We have written before about how one bad submission ripples through every downstream system — Gravity Forms is often where that ripple starts, because it is so frequently the front end of a real sales process.
So the goal is not just "fewer spam emails." It is keeping the junk out of the systems Gravity Forms feeds. That means catching it at submission time, before an entry is created and the automation fires.
Why Bot-Detection Alone Falls Short Here
The two default reflexes — a honeypot field and reCAPTCHA — both aim at the same target: is the submitter a bot? For a high-value lead form, that leaves two big gaps.
First, a growing share of form spam is written by language models or submitted by humans in low-cost click farms. It reads like a real enquiry, passes a bot check, and lands in your pipeline looking legitimate until a rep wastes half an hour on it.
Second, bot detection tells you nothing about content risk. A Gravity Form that collects free-text — "describe your project," "additional comments" — can receive profanity, abuse, or phishing URLs from a perfectly human visitor. reCAPTCHA waves all of it through.
Content-level scoring closes both gaps by evaluating what was actually typed.
Using the gform_entry_is_spam Filter
Gravity Forms exposes a clean hook for exactly this: gform_entry_is_spam. Return true and the entry is routed to the spam folder rather than your live entries — so nothing breaks, notifications and feeds are suppressed, and you keep a copy to review for false positives.
add_filter( 'gform_entry_is_spam', function ( $is_spam, $form, $entry ) {
if ( $is_spam ) {
return true; // already flagged
}
// Collect the free-text fields worth scoring.
$text = '';
foreach ( $form['fields'] as $field ) {
if ( in_array( $field->type, array( 'textarea', 'text', 'post_content' ), true ) ) {
$text .= ' ' . rgar( $entry, (string) $field->id );
}
}
$text = trim( $text );
if ( $text === '' ) {
return $is_spam;
}
$response = wp_remote_post( 'https://api.babelshield.com/v1/score', array(
'headers' => array(
'Authorization' => 'Bearer ' . BABELSHIELD_API_KEY,
'Content-Type' => 'application/json',
),
'body' => wp_json_encode( array( 'text' => $text ) ),
'timeout' => 3,
) );
if ( is_wp_error( $response ) ) {
return $is_spam; // fail open — never lose a real lead to an API hiccup
}
$scores = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ( $scores['spam'] ?? 0 ) > 0.8 || ( $scores['junk'] ?? 0 ) > 0.85 ) {
return true;
}
return $is_spam;
}, 10, 3 );
(Endpoint, field names, and thresholds are illustrative — check the current Babelshield docs and tune to your forms.)
Because flagged entries go to the spam folder rather than being deleted, this approach is safe to deploy on a live lead form. If a real enquiry ever gets caught, it is sitting right there to be un-marked, and Gravity Forms will happily reprocess it.
Tuning for Lead Forms Specifically
A few adjustments matter more on Gravity Forms than on a basic contact page.
Score the fields that carry meaning. A lead form has name, email, company, and budget fields that are structured, plus one or two free-text fields where the real signal (and the real spam) lives. Concatenate the free-text fields and score those, rather than every field on the form.
Lean on the junk score. On high-value forms, gibberish and form-filler are as much of a problem as overt spam — they are the bot submissions that inflate your conversion count with nothing behind them. The junk category catches the ones that are not selling anything but are not real either.
Feed the score into routing, not just blocking. Because you can read the scores in the same hook, you can also stash them on the entry as metadata and use them downstream — prioritising clean, high-intent leads for immediate follow-up and holding borderline ones for a human glance. Your reps spend their time on the leads most likely to be real.
The Payoff
Wire content scoring into gform_entry_is_spam and the effect shows up where it counts: fewer fake entries, a cleaner CRM, more honest reporting, and reps who are not burning hours on contacts that never existed. The form experience for a real prospect does not change — no CAPTCHA, no extra step, no friction on the exact forms where friction costs you the most.
Gravity Forms is where a lot of businesses turn a click into a lead. Protecting that moment on content, not just on bot signals, is how you keep the pipeline it feeds worth trusting.
References
Gravity Forms documentation. The gform_entry_is_spam filter and spam handling.
WordPress / GravityForms.com. Installation and licensing figures.
Imperva. "2025 Bad Bot Report."