Do you know you can add functionality to your Gravity Forms Merge Tags. This can come in handy, for example when you want to show a field input capitalized or you want to replace certain values in the field.

Merge Tag Modifier Gravity Forms
Create a Merge Tag modifier for uppercase
Take for example that you want to show a certain Merge Tag value in capital letters. A simple way to do that is to add a Gravity Forms Merge Tag modifier to your functions.php.
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value ) {
if ( $merge_tag != 'all_fields' && $modifier == 'gwp_uppercase' ) {
$value = strtoupper ( $value );
}
return $value;
}, 10, 5 );
You can see we do different things in the PHP code:
- add a filter to the gform_merge_tag_filter hook
- check if it's not used in the all_fields Merge Tag from Gravity Forms (since this is a unique merge tag to output all the data in a table, we don't want to attach our modifier to that one)
- check if the modifier is gwp_uppercase
- do something with the value that is passed (this is the value that the visitor filled in in the specific field you refer to with the modifier)
- in our case: we use the PHP standard function strtoupper to make all the letters uppercase
How to use your uppercase Merge Tag modifier?
After adding your fresh PHP code to your functions.php file in your theme or child theme, you can use the gwp_uppercase modifier to output Merge Tag values in capital letters. Use it like this:{Your first field:1:gwp_uppercase}
Hire the best developers for Gravity Forms

Click here to visit Codeable