gwp_replace
With the gwp_replace Merge Tag Modifier for Gravity Forms you can search and replace parts of the field value before outputting it to the screen.
:gwp_replace search= replace=
If you want to change the output of a Merge Tag text, use the Modifier like this:
Example | Modifier | Output |
---|---|---|
{Example:1} | GravityWP | |
{Example:1:gwp_replace search="ravity" replace="RAVITY"} | :gwp_replace search=”ravity” replace=”RAVITY | GRAVITYWP |
{Example:1:gwp_replace search="WP" replace=" Forms"} | :gwp_replace search=”WP” replace=” Forms” | Gravity Forms |
Try it
Support for Nested Mergetags
Read more about Nested Mergetags here. Example of gwp_replace to search and replace with values from other fields in your Gravity Form:
{String:1:gwp_replace search='*|Which part to replace:2|*' replace='*|Replace with:3|*'}
Support for Nested Modifiers
Read more about Nested Modifiers here. Example of gwp_replace with one nested (extra) modifier, wehere ‘GravityWP’ is replaced by ‘WP’ with the original modifier and ‘cool’ by ‘awesome’ by the nested modifier.
{Example:1:gwp_replace search="GravityWP" replace="GWP" modifier1='gwp_replace search="cool" replace="awesome"'}
Replace multiple values
To search and replace multiple values you can use this generator, it will create up to 8 Nested Modifiers for you. Just remove the ones you don’t need.
Last updated: 10-07-2023