Docs

Contact Form 7 Integration

3 min readUpdated July 4, 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 — add [wpsc_consent] to your form template where you want the consent checkbox to appear (before the submit button). The checkbox label is pulled from your global Opt-in Label setting. Only submissions where the visitor ticked the checkbox are forwarded to your CRM destinations.

Newsletter mode — no checkbox needed. 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 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. Click + Add extra field, 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.

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 Contact mode is selected and [wpsc_consent] is present in the form template before the submit button.

Consent not being capturedwpcf7_mail_sent only fires when CF7 successfully sends its mail. If CF7 has a mail configuration error 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