🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms hCaptcha Premium Add-on Setup Guide

Updated 8 min read Gravity Forms Integrations A–Z
On this page
  1. Video walkthrough
  2. What the Add-on Does
  3. Installation
  4. Step 1: Add Your hCaptcha Keys
  5. Step 2: Choose the Checking Rules
  6. Step 3: Add the hCaptcha Field to a Form
  7. What Visitors See
  8. Multi-page Forms, AJAX and Save and Continue
  9. The Result on Each Entry
  10. Privacy: What Is Sent to hCaptcha
  11. Working Next to Other CAPTCHA Fields
  12. Errors and What They Mean
  13. For Developers
  14. Troubleshooting
  15. The widget does not appear.
  16. Every submission is refused with “could not check”.
  17. What happens without an active licence?
  18. Can I use hCaptcha and the Gravity Forms reCAPTCHA field together?
  19. What does uninstalling remove?
  20. Stop Form Spam With hCaptcha

Video walkthrough

Gravity Forms hCaptcha: Setup, Key Test, Fail Closed and the hCaptcha Field
Watch: set up hCaptcha spam protection for Gravity Forms on the WordPress side. Watch on YouTube

The Gravity Forms form editor with an hCaptcha field added below the Message field and its Field Settings open on the right: field label hCaptcha, and the hCaptcha settings Mode Invisible, Theme Dark, Size Compact and Language French, with a note that invisible mode runs the check when the visitor submits
The hCaptcha field in the form editor: mode, theme, size and language per field.

Requirements

  • WordPress 6.5 or newer and PHP 7.4 or newer.
  • Gravity Forms 2.9 or newer (any licence). Tested with Gravity Forms 2.9 and 3.1.
  • An hCaptcha account (the free plan works) with a site key and a secret.
  • Your server must be able to reach api.hcaptcha.com over https.

What the Add-on Does

hCaptcha is a bot detection service that asks visitors to prove they are human, either with a checkbox or completely in the background. The add-on adds an hCaptcha field to Gravity Forms. When the form is submitted, your server sends the answer to hCaptcha together with your secret and only accepts the entry when hCaptcha confirms it. Bots that post straight to your form without loading the page never get a valid answer, so they never get an entry.

Everything that matters for real sites is handled: AJAX forms, multi-page forms, Save and Continue, several forms on one page, forms that come back with an error, a slow or unreachable hCaptcha, and the Gravity Forms reCAPTCHA field on the same site. Each entry keeps the result, and Enterprise accounts can refuse entries above a risk score.

Installation

  1. Download the add-on zip from your GravityExtra account and upload it in Plugins → Add New → Upload Plugin, then activate it.
  2. Go to Forms → Settings → hCaptcha, enter your key in the Gravity Extra License section and click Activate License.
  3. Add your hCaptcha keys in the same screen (step 1), then add the field to your forms (step 3).

Step 1: Add Your hCaptcha Keys

  1. Sign in to the hCaptcha dashboard. Under Sites, add your site (or open it) and copy its site key. It looks like four groups of letters and numbers separated by dashes.
  2. Under Settings, copy your secret. It starts with 0x or ES_.
  3. Paste both in WordPress and click Save Settings. The add-on asks hCaptcha whether the keys belong together before it saves them; a wrong secret or a site key from another account is refused with the reason.
  4. Click Test the keys at any time. For a full check, click Show the widget, solve it, then click Test the keys: the add-on sends the real answer to hCaptcha and shows the result, including the host name where it was solved and, for Enterprise, the risk score.

The secret is never shown again after saving and never written to notes or logs. Leave the field empty to keep the saved secret.

Trying it out first?

hCaptcha publishes test keys for developers. With the test site key 10000000-ffff-ffff-ffff-000000000001 and the test secret 0x0000000000000000000000000000000000000000 the widget shows a red “for testing only” line and every check passes. The settings screen warns you while they are saved. Replace them with your own keys before going live.

Step 2: Choose the Checking Rules

Setting What it does
When hCaptcha cannot be reached Refuse the entry (fail closed, the default) asks the visitor to try again when hCaptcha does not answer in time, answers with an error, or refuses your keys. Accept the entry (fail open) saves it and marks it “not checked” with a note. A wrong, expired or reused answer is always refused.
Timeout How many seconds to wait for hCaptcha (2 to 30, default 10).
Visitor IP address Sends the visitor’s IP address with the check, as hCaptcha recommends. Enterprise risk scores need it.
Risk score limit (Enterprise) Entries with a risk score at or above this number are refused. Higher scores mean more likely malicious. Leave empty to turn it off; it is ignored when hCaptcha returns no score.
Entry note Add a note when there is a risk score or the check was skipped, for every entry, or never.

The settings screen also shows the last problem the add-on met, such as a refused secret or a timeout, with the time it happened, so you notice a configuration issue before your visitors do.

Step 3: Add the hCaptcha Field to a Form

Open the form in the editor and click hCaptcha in Advanced Fields. Place it just above the submit button. A form can have one hCaptcha field; the editor refuses a second one.

Field setting Choices
Mode Checkbox shows the “I am human” box. Invisible shows no box: the check runs when the visitor clicks Submit or Next and a challenge only appears when hCaptcha needs one.
Theme Light or dark.
Size Normal or compact (useful in narrow columns).
Language Automatic (the visitor’s browser language) or one of the languages hCaptcha supports.

Every setting can stay on Use the default, which follows the defaults in Forms → Settings → hCaptcha. The label, description, custom error message and CSS class work like on any Gravity Forms field. In invisible mode the label is hidden and the field shows the notice hCaptcha asks for: “This form is protected by hCaptcha and its Privacy Policy and Terms of Service apply.”

Passive and 99.9% passive modes

On Pro and Enterprise plans you can choose these modes for your site key in the hCaptcha dashboard. Most visitors then never see a challenge. Nothing changes in WordPress: keep the field in checkbox or invisible mode and the add-on works the same way.

What Visitors See

  • Checkbox mode: the visitor ticks the box (and solves a challenge if hCaptcha asks for one) and submits. Without a tick, the form says “Please confirm you are human with the hCaptcha check.”
  • Invisible mode: the visitor just clicks Send. If they close a challenge, the form stays where it is and says the check was closed, so they can try again.
  • Errors elsewhere: when another field has an error, the form comes back with “Verified by hCaptcha” instead of a new puzzle. The visitor only fixes the field.
  • Expired answers: an answer is only valid for a short time. If it expires before submitting, the box clears and asks for a new tick.
A Contact form on the site after a submit with a missing message: Gravity Forms shows the error for the Message field, while the Spam check field shows the green box Verified by hCaptcha, so the visitor does not have to solve the check again
Another field had an error: the check stays verified, so the visitor only fixes the message.

Multi-page Forms, AJAX and Save and Continue

  • Multi-page forms: put the field on the last page and the check runs when the form is submitted. Put it on an earlier page and the check runs when the visitor leaves that page; a signed pass, valid for 30 minutes and only once, carries the result to the final submit. A copied pass cannot be used for a second entry.
  • AJAX forms: everything works without a page reload, including invisible mode and multi-page AJAX forms.
  • Save and Continue: saving a draft never runs the check and never stores an hCaptcha answer in the draft. When the visitor comes back, the field shows a fresh widget.
  • Several forms on one page: every hCaptcha field gets its own widget and only the submitted form is checked. The hCaptcha script is loaded once per page, so the language of the first form on the page is used.

The Result on Each Entry

A Membership entry in Gravity Forms with the note from hCaptcha: passed, risk score 0.1 with the limit 0.7, reason safe, next to the entry fields name, e-mail and message
Every entry keeps the hCaptcha result; Enterprise risk scores are written as a note.

Each entry stores the result as entry meta: hCaptcha (passed, or not checked when fail open let it through) and, for Enterprise accounts, hCaptcha risk score. Add them as columns in the entry list, filter by them or include them in exports. The note on the entry reads for example “hCaptcha: passed. Risk score 0.1 (limit 0.7). Reasons: safe.” The hCaptcha field itself saves no value, so it never appears in the entry fields, merge tags or exports.

Privacy: What Is Sent to hCaptcha

When a form is submitted, your server sends hCaptcha exactly four things: your secret, the answer token from the widget, your site key, and (if you allow it) the visitor’s IP address. Nothing the visitor typed into the form is ever sent. The widget itself is loaded from hCaptcha in the visitor’s browser, so mention hCaptcha in your privacy policy.

Working Next to Other CAPTCHA Fields

The hCaptcha script normally also answers to the name used by Google reCAPTCHA. The add-on turns that off, so the Gravity Forms reCAPTCHA field on another form of the same page keeps working with Google. Cloudflare Turnstile, for example in the GravityExtra Fraud Shield add-on, uses its own script and fields and is not affected.

Errors and What They Mean

Message or note Cause
Please confirm you are human with the hCaptcha check. The box was not ticked (no answer sent).
The hCaptcha check failed or expired. Please try again. hCaptcha refused the answer: wrong, expired, already used, or above your risk score limit.
We could not check the hCaptcha right now. Fail closed: hCaptcha did not answer in time, answered with an error, or refused your keys. See Last problem in the settings.
hCaptcha: not checked Fail open: the same problems, but the entry was saved and marked.
The site key does not belong to this secret’s account The site key and the secret come from different hCaptcha accounts.
The visitor IP address is required by this site key An Enterprise site key needs the IP address: turn on Visitor IP address.

For Developers

  • gehc_skip_check (bool, form) skips the check for a submission, for example one made by your own code.
  • gehc_load_api (bool, form) returns false when another plugin already loads the hCaptcha script on the page.
  • The entry meta keys are gehc_result and gehc_score.
// Skip the check for submissions made by your own code through the Gravity Forms API.
add_filter( 'gehc_skip_check', function ( $skip, $form ) {
    return defined( 'MY_IMPORT_RUNNING' ) ? true : $skip;
}, 10, 2 );

// Another plugin already loads the hCaptcha script on this page.
add_filter( 'gehc_load_api', '__return_false' );

Troubleshooting

The widget does not appear.

Check that the site key is saved and that the domain of your site is added to that site key in the hCaptcha dashboard. A content security policy must allow hcaptcha.com and its subdomains.

Every submission is refused with “could not check”.

Open the settings and read Last problem. Usually the secret was changed in hCaptcha, or the server cannot reach api.hcaptcha.com because of a firewall. Test the keys shows the same answer.

What happens without an active licence?

You cannot add new hCaptcha fields. Fields that are already on your forms keep protecting them, so spam protection never stops.

Can I use hCaptcha and the Gravity Forms reCAPTCHA field together?

Yes, on different forms, even on the same page. Use one CAPTCHA per form.

What does uninstalling remove?

Uninstalling from Forms → Settings → Uninstall removes the add-on settings and its single-use markers. Entries and their hCaptcha results stay.

Stop Form Spam With hCaptcha

Add an hCaptcha field to any Gravity Form, check every answer on your server, and keep the result with each entry.

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr