Nested Merge Tags
Since GravityWP – Advanced Merge Tags 1.2 it’s possible to use Nested Merge Tags (variables) inside your Advanced Merge Tag modifiers.
Currently supported in:
- Merge tags with search filters, like filter1=
- gwp_date_format
- gwp_date_updated
- gwp_date_created
- gwp_append
- gwp_replace
How to use nested Merge Tags?
When using Merge Tags inside Merge Tags or Modifiers, you have to change the curly brackets. For example when you want to use the value of this example Merge Tag:
{String:1}
You have to use it like this:
*|String:1|*
Example gwp_replace with Nested Merge Tags
For example: you have three Single Line Text fields in your Gravity Form.
- A string you want to replace part of (Field ID 1)
- The part you want replaced (search=) (Field ID 2)
- What you want to replace it with (replace=) (Field ID 3)
Without Nested variables this would look like this, where ‘WP’ would be replaced by ‘WordPress’:
{String:1:gwp_replace search='WP' replace='WordPress'}
When using Nested variables, where we use data from the entry itself to replace the text, it would look like this:
{String:1:gwp_replace search='*|Which part to replace:2|*' replace='*|Replace with:3|*'}