Im trying to rename name of input in contact from 7. There is integration with google sheets, and name of input must be same as is named a column in the sheet. Issue is when you need two words name, its not supported.
Here is code what should rename input:
function custom_rename_form_field($contact_form) {
$submission = WPCF7_Submission::get_instance();
if ($submission) {
$data = $submission->get_posted_data();
if (isset($data['jaky-obchod'])) {
$jakyObchodValue = $data['jaky-obchod'];
unset($data['jaky-obchod']);
$data['Jaký obchod'] = $jakyObchodValue;
$submission->set_posted_data($data);
}
}
}
But im getting error 500.
name "jaky-obchod" should be renamed to "Jaký obchod" before contact from 7 send data
What about this ? Try wpcf7_before_send_mail hook instead of wpcf7_submit...