gpep_field_values

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Disabling Passthrough With Query Parameter

Description

This filter allows you to modify the passthrough field values prepared for a form.

Usage

add_filter( 'gpep_field_values', 'your_function_name', 10, 2 );

Parameters

  • $field_values array

    The prepared field values to be passed through.

  • $form_id int

    The ID of the form being populated.

Examples

Disabling Passthrough With Query Parameter

This example prevents field values from being passed through from another form by adding passthrough=0 to the query parameters.

<?php
/**
 * Gravity Perks // Easy Passthrough // Disabling Passthrough With Query Parameter
 * https://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
 */
add_filter( 'gpep_field_values', function( $field_values, $form_id ) {
	// If passthrough=0 is in the query parameters, return an empty array.
	if ( '0' == rgget( 'passthrough' ) ) {
		return array();
	}
	return $field_values;
}, 10, 2 );