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

Gravity Forms Image and Math Captcha Premium Add-on Setup Guide

Updated 9 min read Gravity Forms Fields & Inputs
On this page
  1. Video walkthrough
  2. What the Add-on Does
  3. Installation
  4. The Three Challenge Types
  5. Math question
  6. Distorted text image
  7. Pick the icon
  8. Adding the Field to a Form
  9. Settings Reference
  10. How a Submission Is Checked
  11. Multi-page Forms, AJAX and Save and Continue
  12. Page Caching and Several Forms per Page
  13. Entry Results
  14. Privacy and GDPR
  15. For Developers
  16. Frequently Asked Questions
  17. Can a bot read the math question?
  18. The text image does not appear.
  19. Visitors say their answer expired.
  20. Real visitors are told they were too quick.
  21. What happens without an active licence?
  22. What does uninstalling remove?
  23. Stop form spam without a third-party service

Video walkthrough

Gravity Forms Math Captcha: Self-Hosted Image and Math Spam Check, No Keys
A self-hosted math captcha for Gravity Forms, no keys Watch on YouTube

A Kiln firing request form on the site with name, e-mail and message fields and the Spam check field: Pick the house, with six icon buttons (cloud, house, star, cup, fish and key style drawings) and the buttons New question and Use a math question instead, above the Send button
Pick the icon: six bundled icons, each with an accessible name, usable with the keyboard.

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.
  • The PHP GD extension for the text image (almost every host has it). Without GD, text image fields ask a math question instead.
  • No account, no API key and no outside service.

What the Add-on Does

The add-on adds an Image & Math Captcha field to Gravity Forms. It asks the visitor a small question that people answer in a few seconds and simple scripts cannot: a math question, the characters of a distorted image, or “pick the icon”. Everything happens on your own WordPress site. No script, font, image or cookie comes from another company, and no visitor data is sent anywhere, which keeps your privacy policy and cookie banner simple.

Behind the question sit four more layers: every question is signed and can be answered only once before it expires, wrong answers are limited per IP address, a hidden honeypot field catches form-filling bots, and answers that arrive faster than a person could type are refused. The field works with AJAX forms, multi-page forms, Save and Continue, several forms on one page and page caching plugins.

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 → Image & Math Captcha, paste your licence key in the GravityExtra License section and click Activate.
  3. Read the green line at the top of the Challenge section. It tells you whether PHP GD and FreeType are available on your server.
  4. Pick your defaults (or keep them) and click Save Settings. That is all the set-up there is: no keys, no account.

The Three Challenge Types

Math question

The visitor sees a question such as “What is 4 + 7?” and types the answer in digits. Choose the operators in the settings (addition, subtraction, multiplication), the difficulty (easy uses numbers 1 to 9, medium up to 20, hard 11 to 50) and whether the numbers are written as digits or as words (“What is fourteen plus six?”). Subtraction never goes below zero and multiplication stays within small tables, so nobody needs a calculator. Math is the most accessible type: screen readers read the question as plain text, and the answer box is labelled by the question itself.

Distorted text image

A Book a wheel class form with the Spam check field showing a distorted text image of four characters drawn on the server, the label Type the characters in the image, an answer box and the buttons New image and Use a math question instead
Distorted text image drawn on your server with PHP GD and a bundled open-licence font.

Your server draws a short code (4 to 8 characters, 5 by default) with PHP GD: rotated letters, a wave, lines and noise. The image is embedded in the page, so there is no extra request. The add-on uses only characters that cannot be confused, with no 0 and O, 1, I and L, 2 and Z, 5 and S, 8 and B, and visitors can type in upper or lower case. Spaces and dashes are ignored. A New image button draws a fresh code. The letters use the bundled Montserrat Bold font (SIL Open Font License); if your server has GD without FreeType, the built-in GD font is used instead.

Pick the icon

The visitor sees “Pick the house” and a row of icons (4, 6 or 8). Each icon is a real radio button with an accessible name, so it works with a mouse, a touch screen and the keyboard: Tab moves into the group, the arrow keys move between icons, Space selects. The values sent with the form are random for every question, never the icon names. The icons are drawn by GravityExtra and ship with the add-on.

The accessible option

With the text image and with icons, the field shows a Use a math question instead button (you can turn it off in the settings). It swaps the challenge for a math question and moves the keyboard focus to the answer box, so visitors who cannot see the image always have a way through.

Adding the Field to a Form

  1. Open the form in the form editor.
  2. In Advanced Fields, click Image & Math Captcha. Place the field just above the submit button (on a multi-page form, on any page).
  3. In the field settings choose the challenge type, math difficulty, digits or words and the number of image characters, or keep “Use the default” to follow the settings page.
  4. Optionally change the field label (“Spam check” by default), the description and the error message.
  5. Save the form.

A form can have one captcha field; the editor refuses a second one. The field is display-only: nothing is saved in the entry fields, merge tags or exports. Conditional logic is not offered for the field because a hidden check would be a skipped check.

Settings Reference

Setting Default What it does
Challenge type Math question Used by fields that keep “Use the default”.
Math operators Addition and subtraction Multiplication can be added; at least one operator is always used.
Math difficulty Easy Easy 1–9, medium up to 20, hard 11–50.
Show numbers as Digits Words are harder for simple bots; visitors always answer with digits.
Characters in the text image 5 4 to 8 characters from a set without look-alikes.
Icons to choose from 6 4, 6 or 8 icons.
Accessible option On Shows “Use a math question instead” with images and icons.
Challenge lifetime 20 minutes A question older than this is refused and replaced (2 to 60).
Minimum time 3 seconds Answers sent faster are refused (0 turns it off).
Honeypot On A hidden field people never see; if it is filled, the entry is refused.
Wrong answers per IP address 10 per 10 minutes After that the address is refused until the 10 minutes are over (0 turns it off).
New questions per IP address 60 per 10 minutes Limits “New question” clicks and questions loaded after the page loads.
Page caching Automatic See the next section.

At the bottom of the settings page a Preview shows one sample of each type with your settings. The samples cannot be answered.

How a Submission Is Checked

  1. When the form is shown, the server creates the question, stores only a hash of the answer (never the answer itself) for the lifetime you set, and puts a signed token in the form.
  2. When the form is submitted, the honeypot is checked first, then the IP limit, then the token: it must be signed by your site, belong to this form and not be expired.
  3. The question is spent at that moment, right or wrong. A second submission with the same token is refused as “expired or already used”.
  4. The answer time is checked against the minimum time, then the answer is compared with the stored hash.
  5. If anything fails, Gravity Forms shows the message under the field and a new question appears. Wrong answers count against the IP address.

Visitors see short, friendly messages: “Please answer the spam check”, “That answer was not right. Please answer the new question”, “That was a little too quick” and so on. You can replace the wrong-answer message with the field’s own error message in the editor.

Multi-page Forms, AJAX and Save and Continue

Visitors answer once per entry. When the answer is right, the server gives the form a signed pass that can be used only once and is valid for 30 minutes. If another field has an error, the form comes back with “Spam check passed” instead of a new question. On multi-page forms the field can sit on any page: the answer is checked when the visitor leaves that page, and the pass travels with the form to the final submit. When the entry is saved, the pass is used up; a copied pass is refused.

AJAX forms are checked the same way without a page reload. Save and Continue never runs the check and never stores a token, an answer or a pass in the draft; the resumed form shows a fresh question.

Page Caching and Several Forms per Page

A cached page would show the same question to every visitor. In Automatic mode the add-on detects a page cache (the WP_CACHE setting that common cache plugins turn on) and loads the question from your own site right after the page loads, through a small REST request that is never cached. Choose Always load the question after the page loads if you use a CDN or host cache that the add-on cannot detect. Always print the question in the page also works without JavaScript; a question that is older than half its lifetime is renewed in the browser.

Several forms on one page each get their own question, token and pass. Submitting one form never touches the others. The field also works next to the Gravity Forms reCAPTCHA field on other forms.

Entry Results

The Gravity Forms entry list of the Contact the studio form with the columns Spam check (passed), Spam check type (math, icons or text) and Spam check seconds next to the name and e-mail of each entry
Every entry keeps the result, the challenge type and how many seconds the visitor needed.

Each entry keeps three values that you can add as columns in the entry list, use in filters and export: Spam check (passed), Spam check type (math, text or icons; “math” when the visitor switched to the accessible option) and Spam check seconds (how long the visitor needed). Refused submissions are never saved.

Privacy and GDPR

The add-on sends nothing to any other server and loads nothing from one. It sets no cookies. It stores, for a short time, the hash of each open question’s answer, single-use markers for spent questions (removed by a daily clean-up), and counters for the rate limit keyed by a hash of the IP address, never the address itself. Because no third party is involved, there is nothing to add to your list of processors.

For Developers

// Skip the spam check for submissions made by your own code through the Gravity Forms API.
add_filter( 'geic_skip_check', function ( $skip, $form ) {
    return defined( 'MY_IMPORT_RUNNING' ) ? true : $skip;
}, 10, 2 );

// Tell the add-on that a page cache is active even when WP_CACHE is not set (CDN or host cache).
add_filter( 'geic_page_cache_detected', '__return_true' );

The REST route used on cached pages is POST /wp-json/geic/v1/challenge with form_id and field_id. It answers only for active forms that contain the field and is limited per IP address.

Frequently Asked Questions

Can a bot read the math question?

A determined bot can, which is why the add-on never relies on the question alone. Single-use signed tokens, the minimum time, the honeypot and the IP limit stop the automated submissions that make up most form spam. Words instead of digits make it harder still.

The text image does not appear.

Read the line at the top of the settings page. If PHP GD is missing, ask your host to enable it; until then text image fields ask a math question so your forms stay protected.

Visitors say their answer expired.

The question lifetime may be too short for long forms, or a page cache is serving old questions. Raise the lifetime or set page caching to “Always load the question after the page loads”.

Real visitors are told they were too quick.

Lower the minimum time to 1 or 2 seconds. Browser autofill can complete the other fields quickly, but the spam check itself always takes a moment.

What happens without an active licence?

You cannot add new captcha fields. Fields already on your forms keep protecting them.

What does uninstalling remove?

Uninstalling from Forms → Settings → Uninstall removes the settings, open questions, markers and counters. Entries and their results stay.

Stop form spam without a third-party service

Math, text image or icons, checked on your own server.

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