Description
The gform_zapier_sample_field_value filter can be used to modify the sample field value before it is sent to Zapier.
Usage
add_filter( 'gform_zapier_sample_field_value', 'your_function_name', 10, 3 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string | The sample value to be modified. |
$form_id | integer | The ID of the form being processed. |
$field_id | string | The ID of the field being processed. |
Examples
Use the filter with a basic value.
add_filter( 'gform_zapier_sample_field_value', 'zapier_sample_field_value', 10, 3 );
function zapier_sample_field_value( $value, $form_id, $field_id ) {
return 'the new value';
}
Replace an email field sample value.
The following example shows how you can replace the sample value used by the Email type field with your own custom sample value.
add_filter( 'gform_zapier_sample_field_value', function ( $value ) {
if ( $value === '[email protected]' ) {
$value = '[email protected]';
}
return $value;
} );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This filter was added in version 1.9.1.
Source Code
This filter is located in GFZapier::get_body() in zapier.php.