Docs

Contact Form 7 Integration

3 min readUpdated June 20, 2026

Contact Form 7 is one of the most widely installed WordPress form plugins. WP Smart Consent integrates with CF7 to add an opt-in checkbox to any form on your site, with per-form configuration managed inside the CF7 form editor.

Enabling the Integration#

In the WP Smart Consent dashboard, go to the Form Sources tab and toggle Contact Form 7 on. This activates the integration globally. Per-form behaviour is configured individually inside each form’s editor.

Screenshot of a WordPress plugin settings page for Contact Form 7 consent mode. The status is "Inactive," and there are two tabs: "General" (selected) and "Collect fields." A toggle lets users enable contact form consent. Below is a green "Save Contact Form 7" button.

Per-Form Settings

WP Smart Consent adds a WP Smart Consent tab to every CF7 form in the editor. Click it to access settings for that specific form.

Enabled — whether this form captures consent at all. You can have CF7 active globally but disable it on individual forms.

Form type — Contact mode or Newsletter mode.

Contact Mode vs Newsletter Mode#

Contact mode — WP Smart Consent injects a consent checkbox above the submit button via the wpcf7_form_elements filter. Only submissions where the visitor ticked the checkbox are forwarded to your CRM destinations.

Newsletter mode — no checkbox is injected. Every successful CF7 submission from this form is treated as an opt-in and forwarded automatically. Use this for dedicated newsletter signup forms where submitting the form is itself the act of consent.

Collect Fields#

The WP Smart Consent tab inside the CF7 editor includes a Collect fields section where you map CF7 field names to standard WPSC data fields.

Email — required. Select the CF7 field that contains the submitter’s email address.

First name, Last name, Phone, Company, Country — all optional. Map whichever CF7 fields you want forwarded alongside the email.

CF7 field names are the name attribute you set in your form tag, for example your-email, your-name, or your-phone. The dropdown is populated from your form’s registered fields automatically.

CF7 does not have a native first/last name split. If your form uses a single your-name field, map it to First name and leave Last name blank.

Extra Fields#

Below the standard field selectors, the Extra fields section lets you map any additional CF7 field to a custom CRM key. Add a row, select the form field on the left, and enter the CRM key on the right.

The CRM key is the identifier your destination platform uses for that field. For example: CITY in Mailchimp (MERGE tag), city in FluentCRM (custom field slug), or city as a HubSpot contact property. Whatever key you enter is what gets sent to your enabled CRM destinations on every opt-in alongside the standard contact data.

How the Submission Hook Works#

WP Smart Consent listens on the wpcf7_mail_sent action, which fires after CF7 has successfully processed the form and sent its configured emails. This means consent is only captured on genuinely successful submissions — validation errors, spam filter blocks, and mail failures do not trigger a consent event.

Field values are read from the WPCF7_Submission object via get_posted_data() and matched by the field names configured in the per-form settings.

Troubleshooting#

Checkbox not appearing — confirm the form is enabled in the WP Smart Consent tab inside the CF7 editor. Also check that no CF7 styling plugin or theme is replacing the submit button area in a way that strips injected HTML.

Consent not being capturedwpcf7_mail_sent only fires when CF7 successfully sends its mail. If CF7 has a mail configuration error (misconfigured SMTP, for example), the action never fires. Confirm CF7 emails are sending correctly first.

Wrong field values forwarded — CF7 field names are case-sensitive. Confirm the names in the WPSC settings panel exactly match the name attributes in your CF7 form tags.

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