Adding field before sending but after validation
-
How can I add a field before the form is sent, but after validation?
wpcf7_posted_data – fired before validation
wpcf7_before_send_mail – too late, I can’t modify or add fieldsfunction action_wpcf7_before_send_mail($cf7) { $submission = WPCF7_Submission::get_instance(); if ($submission) { $form_data = $submission->get_posted_data(); $form_data['new-field'] = getSomeDataFromExternalApi(); // now what? } } add_action('wpcf7_before_send_mail', 'action_wpcf7_before_send_mail', 10, 1);
- The topic ‘Adding field before sending but after validation’ is closed to new replies.