gform_form_pre_update_entry

Description

Allows the form object to be modified before the entry is updated by an add-on or the API.

Usage

The following would apply to all forms:

add_filter( 'gform_form_pre_update_entry', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_form_pre_update_entry_FORMID)

add_filter( 'gform_form_pre_update_entry_1', 'your_function_name', 10, 3 );

Parameters

Example

The example below removes one of the form fields from the Form Object so that it is not updated with the entry data.

add_filter( 'gform_form_pre_update_entry', 'modify_form', 10, 3 );
function modify_form( $form, $entry, $entry_id ){
	$fields = $form['fields'];
	foreach ( $fields as $field ){
		if ( $field['label'] == 'Test') {
			continue;
		}
		$new_fields[] = $field;
	}
	$form['fields'] = $new_fields;
	return $form;
}

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms version 1.9.9.

Source Code

This filter is located in GFAPI::update_entry() in includes/api.php and
GF_Forms_Model_Legacy::update_entry() in includes/legacy/forms_model_legacy.php.