Description

Fires after all field validation and formatting data.

Parameters

$fields
(array) Sanitized entry field values/properties.
$entry
(array) Original $_POST global.
$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms/includes/class-process.php

More Information

The wpforms_process_filter hook fires at the very end once the field validation and formatting the data.

Examples

Remember to change your form ID from 817 to the form ID that you’re targeting.

/**
 * Fires after all field validation and formatting data.
 *
 * @link  https://wpforms.com/developers/wpforms_process_filter/
 *
 * @param  array  $fields     Sanitized entry field values/properties.
 * @param  array  $entry      Original $_POST global.
 * @param  array  $form_data  Form data and settings.
 *
 * @return array 
 */

function wpf_dev_process_filter( $fields, $entry, $form_data ) {
 
    // Only run on my form with ID = 817
    if( $form_data[ 'id' ] != 817 ) {
        return $fields;
    }
 
    // Run code

}
add_filter( 'wpforms_process_filter', 'wpf_dev_process_filter', 10, 3 );


Another example could be when the Show Values tutorial has been implemented to save the value instead of the label.

/**
 * Save choices `values` instead of `labels` for the fields with `Show values` option enabled.
 *
 * @link   https://wpforms.com/developers/wpforms_process_filter/
 *
 * @param  array  $fields    Sanitized entry field. values/properties.
 * @param  array  $entry     Original $_POST global.
 * @param  array  $form_data Form data and settings.
 *
 */
function wpf_dev_process_filter_choices_values( $fields, $entry, $form_data ) {
​
	if ( ! is_array( $fields ) ) {
		return $fields;
	}
​
	foreach ( $fields as $field_id => $field ) {
		if (
			isset( $field['type'] ) &&
			in_array( $field['type'], [ 'checkbox', 'radio', 'select' ], true ) &&
			! empty( $form_data['fields'][ $field_id ]['show_values'] )
		) {
			$value_raw           = ! empty( $field['value_raw'] ) ? $field['value_raw'] : '';
			$field['value_raw']  = $field['value'];
			$field['value']      = $value_raw;
			$fields[ $field_id ] = $field;
		}
	}
​
	return $fields;
};
add_filter( 'wpforms_process_filter', 'wpf_dev_process_filter_choices_values', 10, 3 );

Snippet Reference: How to Increment a Count on Each Form Submission