Reserved field names
-
This code will remove field names limitation.
All reserved field names will be available.// Add prefix to form fields add_filter( 'wpcf7_form_tag', function ($scanned_tag) { if (!is_admin()) { if ($scanned_tag['name']) { $scanned_tag['name'] = 'wpcf7_' . $scanned_tag['name']; } } return $scanned_tag; }, 10, 2 ); // Remove prefix in data fields add_filter( 'wpcf7_posted_data', function ($posted_data) { foreach ($posted_data as $key => $value) { if (substr($key, 0, 6) == 'wpcf7_') { $posted_data[substr($key, 6)] = $value; unset($posted_data[$key]); } } return $posted_data; }, 1 ); // Deactivate error_unavailable_names for form edit page add_action( 'wpcf7_config_validator_validate', function (WPCF7_ConfigValidator $instance) { if ($instance->count_errors('section=form.body&code=' . $instance::error_unavailable_names)) { $instance->remove_error('form.body', $instance::error_unavailable_names); } } );
The topic ‘Reserved field names’ is closed to new replies.