What is $posted_data passed to Contact Form 7’s wpcf7_posted_data hook

For a ContactForm7 form that has this source:

<div class="wpcf7-lead-widget">[text* contact-name maxlength:50 placeholder "Your Name (required)"]
[email* email maxlength:50 placeholder "Email (required)"]
[text phone maxlength:15 placeholder "Phone"]
[vehicle_form_field]
[textarea comments x3 placeholder "Questions and Comments"]
[submit class:_button class:_button-small "Check Availability"]
[hidden context id:context "contact"]
[hidden do-not-send-mail]</div>

The $posted_data that is passed via the wpcf7_posted_data hook looks like this:

Array
(
[_wpcf7] => 10610
[_wpcf7_version] => 5.1.1
[_wpcf7_locale] => en_US
[_wpcf7_unit_tag] => wpcf7-f10610-p7983-o1
[_wpcf7_container_post] => 7983
[g-recaptcha-response] =>
[contact-name] => Corey
[email] => [email protected]
[phone] => 8005556666
[inventory-post-id] => 7983
[comments] => Super interested in this sandbox
[context] => contact
[do-not-send-mail] =>
)

The first item is the form ID, and all items after g-recaptcha-response are the values of the fields provided by the the user (or the source in the case of the hidden fields). inventory-post-id is the value of a drop down created by the shortcode in our form, [vehicle_form_field].

Leave a comment

Your email address will not be published. Required fields are marked *