Description
The wsf_submit_hidden_fields filter hook allows you to inject additional hidden fields containing values when the form is submitted.
Usage
add_filter( 'wsf_submit_hidden_fields', 'my_hook_function', 10, 2 );
Parameters
$submit_hidden_fields
ArrayAn array of hidden fields.$form
Form ObjectThe form object.
Example
// Callback function for the wsf_submit_export_csv_row filter hook public function my_hook_function( $submit_hidden_fields, $form ) { // Add a hidden field named my_field_1 with a value of my_value $submit_hidden_fields[] = array( 'name' => 'my_field_1', 'value' => 'my_value', ); // Add a hidden field named my_field_2 that extracts a value from local storage using the key local_storage_key $submit_hidden_fields[] = array( 'name' => 'my_field_2', 'value' => 'local_storage_key', 'type' => 'local_storage', ); return $submit_hidden_fields; } // Add a callback function for the wsf_submit_export_csv_row filter hook add_filter( 'wsf_submit_hidden_fields', 'my_hook_function', 10, 2 );
Source File
This hook can be found in:<plugin root>/includes/core/class-ws-form-form.php