Add-on: Advanced Merge Tags
The Advanced Merge Tags Add-On for Gravity Forms adds extra Merge Tag modifiers (and a lot of power) to your Forms. From the most common used functions like capitalize and trim to changing date formats and encrypting or retrieving information.
Advanced Merge Tags adds two kinds of tools:
- Modifiers change the value of a field merge tag. Add them after the field ID, with their options:
{Name:1:gwp_case to=upper}. - Merge tags produce a value of their own, like the current date or a value from another form:
{gwp_now format="d-m-Y"}.
Both work wherever Gravity Forms replaces merge tags, like notifications, confirmations, GravityView and Gravity Flow. Modifiers on field values and merge tags that read the entry need a submitted entry; merge tags like gwp_now, gwp_url and gwp_user also work in default values and HTML fields.
Modifiers
Text
| Modifier | What it does |
|---|---|
| gwp_case | Change to uppercase, lowercase, first letter uppercase or lowercase, or capitalize every word. |
| gwp_append | Add text before and after the value, only when the value is not empty. |
| gwp_replace | Search and replace text, case sensitive or not. |
| gwp_substring | Return part of the value; also works in calculations. |
| gwp_reverse | Reverse the characters. |
| gwp_remove_accents | Replace accented characters with plain letters. |
| gwp_sanitize | Clean up the value: strip tags, trim, make a slug or a positive integer. |
| gwp_censor | Mask the words in the WordPress disallowed words list. |
| gwp_length | Count the characters. |
| gwp_word_count | Count the words; also works in calculations. |
Dates
| Modifier | What it does |
|---|---|
| gwp_date_format | Format a date, shift it (like +3 weekdays) and convert it to another timezone. |
Values from other forms
| Modifier | What it does |
|---|---|
| gwp_get_matched_entry_value | Get one value from a matching entry in another form. Also a merge tag. |
| gwp_get_matched_entries_values | Show values of all matching entries as a list or HTML table. |
| gwp_count_matched_entries | Count the matching entries. Also a merge tag. |
| gwp_sum_matched_entries_values | Add up a number field of the matching entries. |
These modifiers share the options for filtering and sorting matched entries, and read entry values only when the Entry access settings of the other form allow it.
Encoding, encryption and data
| Modifier | What it does |
|---|---|
| gwp_urlencode | URL-encode the value for a link, also for Checkbox and List fields. |
| gwp_urldecode | Decode a URL-encoded value. |
| gwp_encrypt | Encrypt the value into a URL-safe string. |
| gwp_decrypt | Decrypt a value made with gwp_encrypt. |
| gwp_hash | Hash the value with an algorithm like sha256 and an optional salt. |
| gwp_json_get | Read one value from a JSON string. |
| gwp_user_role | Show the roles of the WordPress user whose login, email or ID is in the field. |
Merge tags
| Merge tag | What it returns |
|---|---|
| gwp_now | The current date and time, formatted and shifted as you like. |
| gwp_current_timestamp | The current Unix timestamp. |
| gwp_date_created | The date the entry was created, formatted and shifted. |
| gwp_date_updated | The date the entry was last updated, formatted and shifted. |
| gwp_date_field | Deprecated: a formatted date from a field. Use gwp_date_format instead. |
| gwp_entry | A property of the current entry, like its ID or status, with modifiers. |
| gwp_eeid | A value of the entry whose encrypted ID is in the URL. |
| gwp_user | A property of the logged-in user, with modifiers. |
| gwp_url | The current URL, the site or home URL, or part of the URL. |
| gwp_parent_slug | The slug of the parent page, or of a higher ancestor. |
| gwp_post_id | The post ID of a URL on your site. |
| gwp_generate_token | A random token, optionally unique. |
| gwp_calculate | The result of a formula, rounded and formatted as a number or currency. |
| gwp_get_matched_entry_value | One value from an entry in another form that matches a fixed value. |
| gwp_count_matched_entries | The number of entries in another form that match a fixed value. |
| gwp_gview_advanced_filter | GravityView filter conditions from the current user’s data (needs GravityKit Advanced Filters). |
Combine and nest
- Nested Modifiers: apply several modifiers to one value with modifier1, modifier2, and so on.
- Nested Merge Tags: use other field values inside a modifier’s options, written as
*|Field:1|*. - Combine regular with advanced modifiers: use a Gravity Forms modifier like
:valuetogether with an advanced modifier, and use gwp_substring and gwp_word_count in calculations. - Relative Date Formats in Gravity Forms: examples of the modify option of the date modifiers and merge tags.
Settings and integrations
- Advanced Merge Tags settings: who may read entry values of a form, the gwp_user_role permission, error messages and merge tags in post content.
- Replace field merge tags in administrative field’s default value: store field values in a hidden administrative Text field.
- Filter and sort matched entries: filter1, operator1, value1, sort_by, sort_order and offset.
- Advanced Merge Tags in GP Populate Anything templates: modifiers and entry merge tags in choice and value templates.
- gwp_substring and gwp_word_count also work in List field column calculations of GravityWP List Number Format.
Advanced Merge Tags in GP Populate Anything templates
Use Advanced Merge Tags modifiers and entry merge tags like gwp_date_created in the Custom Value templates of GP Populate Anything when you populate from Gravity Forms entries.
Advanced Merge Tags settings
All settings of GravityWP Advanced Merge Tags: replacing merge tags in administrative fields and post content, error messages, entry access per form or field, and the gwp_user_role permission.
Combine regular with advanced modifiers
Combine modifiers like :value with advanced merge tag modifiers.
Filter and sort matched entries
How to add search filters (filter1, operator1, value1) and sorting (sort_by, sort_order, offset) to the Advanced Merge Tags modifiers that read entries from another form.
gwp_append
Append text before and/or after the field value if the value is not empty.
gwp_calculate
The gwp_calculate Merge Tag returns the result of a calculation formula and formats the number as specified.
gwp_case
Change value to uppercase, lowercase, first character uppercase or lowercase, or uppercase all the words
gwp_censor
The gwp_censor Merge Tag modifier censors blacklisted words in a string using either a specified character or a fixed-length string.
gwp_count_matched_entries
This modifier can be used to count entries from another form, based on a shared value with optional extra filters.
gwp_current_timestamp
Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
gwp_date_created
Returns a modified date time relative to the date time when the entry was created in the desired format.
gwp_date_field
Returns a modified date time relative to the date time of a field-value with a date/time string in the desired format.
gwp_date_format
Returns a modified date time relative to the date time of a field-value with a date/time string in the desired format.
gwp_date_updated
Returns a modified date time relative to the date time when the entry was last updated in the desired format.
gwp_decrypt
Decrypt values that were encrypted using gwp_encrypt.
gwp_eeid
Enables the retrieval of entry properties using the encrypted entry ID (eeid) URL parameter. Intended for use on pages/posts/confirmation messages that are displayed in the browser.
gwp_encrypt
Encrypt entry ids or entry field values using OpenSSL encryption.
gwp_entry
Returns a property or field value of the current Gravity Forms entry, like the entry ID or creation date, and lets you apply advanced modifiers to it.
gwp_generate_token
Generate a random token with customizable attributes like length and character set
gwp_get_matched_entries_values
Gets styled multiple values from matched active entries.
gwp_get_matched_entry_value
Retrieve values from entries from another form, based on a shared value.
gwp_gview_advanced_filter
The gwp_gview_advanced_filter merge tag is designed to dynamically filter entries in GravityViews, leveraging user meta properties that store JSON-encoded arrays of filter values.
gwp_hash
The `gwp_hash` modifier can be used to generate a hash of a field value with a specified algorithm and an optional salt. This can be useful for comparing data while hiding the actual value.
gwp_json_get
The gwp_json_get modifier is extracts values from a JSON string stored in a Gravity Forms Field.
gwp_length
Count the number of characters.
gwp_now
Returns the currrent date and / or time or a modified and formatted date / time relative to the current date / time.
gwp_parent_slug
Returns the slug of one of the parent posts of the current post and let's you pick the depth of ancestor you need.
gwp_post_id
Returns the post-id for a certain url.
gwp_remove_accents
Converts all accent characters to ASCII characters.
gwp_replace
Search and replace field values
gwp_reverse
Reverses a text string.
gwp_sanitize
The gwp_sanitize modifier allows you to display sanitized or trimmed values
gwp_substring
Retun a substring (part of) the original value and specify where the substring starts and what is the length.
gwp_sum_matched_entries_values
The gwp_sum_matched_entries Modifier can be used to calculate the sum of a field value in multiple entries from another form, based on a shared value with optional extra filters.
gwp_url
Returns the WordPress site url, the WordPress home url, the current url, or an element of the current url.
gwp_urldecode
The gwp_urldecode can be used to decode url encoded values.
gwp_urlencode
URL encode the field value to pass it as an url parameter for dynamic population.
gwp_user
Allows the dynamic retrieval of user information based on the current logged-in user's properties.
gwp_user_role
Retrieve and display user roles based on a field value with the user's login, email, or ID
gwp_word_count
Counts the number of words in a string value.
Nested Merge Tags
How to use Merge Tag values inside Advanced Merge Tags and Modifiers.
Nested Modifiers
Use multiple, nested modifiers to perform different actions on the Merge Tag value.
Relative Date Formats in Gravity Forms (gwp_date_format, gwp_date_created, gwp_date_updated)
The Gravity Forms relative date feature in gwp_date_format lets you shift dates with the modify parameter. Use expressions like “+1 week” or “next Monday” and combine with merge tags such as gwp_date_created and gwp_date_updated to display dynamic, timezone-aware dates in confirmations and pages.
Replace field merge tags in administrative field's default value
Allows replacement of field merge tags in a text field's value after submission of the form.