Description

This filter runs on the value that gets saved for the custom field (what gets passed to update_post_meta()).

Parameters

$field_value
(string) Field value from the form.
$meta_key
(string) Custom field meta key.
$field_id
(int) Field ID.
$fields
(array) Sanitized entry field values/properties.
$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms-post-submissions/class-post-submissions.php

More Information

The wpforms_post_submissions_process_meta filter can be used to change the value of a saved field from the Post Submissions Addon.

Examples

Below is an example snippet with this filter that will change the post_meta save to use the UNIX timestamp.

/**
 * Customize post_meta value during WPForms Post Submissions processing.
 *
 * @link   https://wpforms.com/developers/wpforms_post_submissions_process_meta/
 *
 * @param  string  $field_value  Field value from the form.
 * @param  string  $meta_key     Custom field meta key.
 * @param  int     $field_id     Field ID.
 * @param  array   $fields       Sanitized entry field values/properties.
 * @param  array   $form_data    Processed form settings/data, prepared to be used later.
 *
 * @return string
 */

function wpf_post_submission_process_meta( $field_value, $meta_key, $field_id, $fields, $form_data ) {
	
	// If the field has a specific meta key and contains a unix time stamp,
	// use that for the post_meta value.
	if ( $meta_key === 'some_post_meta_key' && ! empty( $fields[ $field_id ][ 'unix' ] ) ) {
		$field_value = $fields[ $field_id ][ 'unix' ];
	}

	return $field_value;
}
add_filter( 'wpforms_post_submissions_process_meta', 'wpf_post_submission_process_meta', 10, 5 );

Remember to replace the meta key in the code above to match whatever meta key you are using.

Snippet Reference: How to Store Checkbox Values as Arrays With Post Submissions