gpep_target_field_value

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Remove price at the end of a specific target field’s value.
  5. Since

Description

Filter the value of a target field’s value.

Usage

Apply to all target fields on forms using GP Easy Passthrough.

add_filter( 'gpep_target_field_value', 'my_custom_function' );

Apply to all target fields on a specific form using GP Easy Passthrough.

add_filter( 'gpep_target_field_value_FORMID', 'my_custom_function' );

Apply to a specific target field on a specific form populated by GP Easy Passthrough.

add_filter( 'gpep_target_field_value_FORMID_FIELDID', 'my_custom_function' );

Parameters

  • $field_value string

    The field value to be displayed in the target field.

  • $form_id string

    Form ID of the current form that the target field belongs to.

  • $target_field_id string

    Field ID that field value is being filtered for.

Examples

Remove price at the end of a specific target field’s value.

This example will change Product Name ($5.00) to Product Name for field 2 on form 19.

<?php
/**
 * Gravity Perks // Easy Passthrough // Remove Price at the End of a Specific Target Field’s Value
 * https://gravitywiz.com/documentation/gravity-forms-easy-passthrough/
 */
// Update '123' to the Tartget Form ID and '4' to the Target field ID.
add_filter( 'gpep_target_field_value_123_4', function( $field_value ) {
	return preg_replace( '/\s?\(.*?\)$/', '', $field_value );
} );

Since

This filter is available since GP Easy Passthrough 1.4.10.