AI Summary
Description
The wpforms_entry_save_args filter is fired before saving the entry and will pass through the arguments for the details captured with the submission.
Parameters
- $args
- (array) Processed submission data, prepared to be stored later such as the user IP Address, user agent, date, etc.
- $form_data
- (array) Processed form settings/data, prepared to be used later.
Source
wpforms/pro/wpforms-pro.php
More Information
The wpforms_entry_save_args filter can be used to alter any information captured during the submission processing before saving the entry.
Example
/**
* Filter for arguments passed through form submission prior to saving the entry.
*
* @link https://wpforms.com/developers/wpforms_entry_save_args/
*
* @param array $args Processed submission data, prepared to be stored later.
* @param array $form_data Processed form settings/data, prepared to be used later.
*
* @return array
*/
function wpf_dev_entry_save_args( $args, $form_data ) {
// Only run on my form with ID = 143, remember to change this to match your form ID
if( $form_data[ 'id' ] != 143 ) {
return $args;
}
$args[ 'user_id' ] = '';
$args[ 'ip_address' ] = '';
return $args;
}
add_filter( 'wpforms_entry_save_args', 'wpf_dev_entry_save_args', 10, 2 );
Related
Tutorial Reference: How to Create an Anonymous Survey Form for Logged In Users