Docs

Gravity Forms Integration

3 min readUpdated June 21, 2026

Gravity Forms is a premium WordPress form builder with advanced conditional logic, multi-page forms, and an extensive add-on ecosystem. WP Smart Consent integrates with Gravity Forms to add an opt-in checkbox to any form, with per-form configuration accessed directly inside the Gravity Forms form settings.

Enabling the Integration#

In the WP Smart Consent dashboard, go to Form Sources and toggle Gravity Forms on. Per-form behavior is then configured individually inside each form’s settings.

A Gravity Forms settings interface shows “Inactive” status. Tabs labeled "General" and "Collect fields" appear. Under "Enable Gravity Forms," an option to add an opt-in checkbox is described. Below is a green "Save Gravity Forms" button.

Per-Form Settings#

WP Smart Consent adds a WP Smart Consent tab to the Gravity Forms form settings. To access it, open any form in Forms → [form name] → Settings, then click the WP Smart Consent tab in the settings navigation. Settings are saved via AJAX using Gravity Forms’ own settings page chrome for a consistent experience.

Gravity Forms stores form definitions in its own custom database table rather than as WordPress posts, so settings are stored in wp_options keyed by form ID.

Form Type#

Contact form — WP Smart Consent prepends the consent checkbox to the submit button markup via the gform_submit_button filter. The checkbox appears immediately above the submit button and is outside Gravity Forms’ field namespace, so it passes through GF’s field processor untouched. Only submissions where the visitor ticked the checkbox are forwarded to your CRM destinations.

Newsletter form — no checkbox is injected. Every successful submission is treated as an opt-in and forwarded automatically.

Collect Fields#

Map the form’s fields to standard WPSC data fields. Gravity Forms identifies fields by their input ID — a numeric string for simple fields (e.g. 2 for a text field with ID 2) or a dotted sub-input ID for compound fields (e.g. 2.3 for the first name portion of a Name field with ID 2, and 2.6 for the last name portion). The dropdown is populated automatically from your form’s registered fields.

Email — required. First name, Last name, Phone, Company, Country — all optional.

Extra Fields#

Below the standard field selectors, the Extra fields section lets you map any additional Gravity Forms field to a custom CRM key. Select the form field on the left and enter the CRM key on the right. That key is sent alongside the standard contact data on every opt-in.

Submission Hook#

WP Smart Consent listens on gform_after_submission, which fires after every successful Gravity Forms submission and entry save. The $entry array is keyed by input ID string, so field value lookups are direct — $entry['2'] for a simple field, $entry['2.3'] for a name sub-field. Only successful, validated submissions trigger consent capture — failed or spam-filtered submissions never reach this hook.

Troubleshooting#

WP Smart Consent tab not visible in form settings — confirm the Gravity Forms integration is enabled in the WPSC dashboard. The tab is added via gform_form_settings_menu which requires Gravity Forms to be active and the form editor to be open.

Checkbox not appearing on the form — confirm the form is enabled in its WP Smart Consent settings tab. The checkbox is injected via the gform_submit_button filter. If another plugin or theme overrides the submit button markup at a higher filter priority, the checkbox may not appear.

Wrong field values forwarded — Gravity Forms name fields split into sub-inputs with dotted IDs (.3 for first name, .6 for last name). If the dropdown shows a name field as a single entry and the value is empty, re-map it to the correct sub-input ID.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only