The {get} merge tag
The {get} merge tag shows the value of a parameter in the page’s address. On the page example.com/deals/?customer=Harbor%20Books, {get:customer} shows Harbor Books.
Use it in a Custom Content field or widget of a View, wherever else GravityView takes merge tags, in the search_value of a [gravityview] shortcode, and in a [gvlogic] condition. This Custom Content widget puts the customer from the address in a heading:

{get} also works as the value of an Advanced Filtering condition. This one lists only the deals of the customer in the address:

Note: The {get} merge tag comes with GravityView. If it isn’t replaced in GravityExport, GravityCalendar, or another add-on, check that GravityView is installed and active.
The format is {get:param}, where param is the name of the parameter in the address. In {get:first-name}, the parameter is first-name.
If the URL doesn’t include the parameter, {get} is replaced with nothing. In an Advanced Filter condition, is with {get:customer} then shows only the entries where the field is empty, while contains and is not show every entry where the field has a value.
Warning: Anyone can change the value in the address. With ?customer=Lumen%20Studio in place of ?customer=Harbor%20Books, the View above lists Lumen Studio’s deals. A {get} condition keeps entries private only when its value is a long random key that only the right person has, as in Show visitors their own entry without an account.
Using {get} with the [gvlogic] shortcode #
Use {get} inside [gvlogic] to show content only when the URL holds a given value:
[gvlogic if="{get:term}" is="Spring"]
Spring catalog
[else]
Other catalog
[/gvlogic]With ?term=Spring in the address, the page shows Spring catalog. With any other term, or none, it shows Other catalog.
To use the value itself, check first that the address has one. This heading greets visitors by the name in the address and falls back to a plain greeting:
[gvlogic if="{get:first-name}" isnot=""]
<h3>Welcome back, {get:first-name}!</h3>
[else]
<h3>Welcome back!</h3>
[/gvlogic]With ?first-name=Lena in the address, the heading reads “Welcome back, Lena!” With no first-name, or an empty one, it reads “Welcome back!”
When the URL has no value #
When {get} in the search_value of a [gravityview] shortcode comes out empty, the View lists every entry unless you add search_value_empty="none". The GravityView block and the page builder widgets have the same choice: set When Search Value is empty to Show no entries. A new block starts there once you choose its View.
To hide the View or show a message of your own when the URL has no value, put the shortcode inside a [gvlogic] condition that checks for one:
[gvlogic if="{get:term}" isnot=""]
[gravityview id="12" search_field="5" search_value="{get:term}" search_value_empty="none"]
[else]
Choose a term to see its classes.
[/gvlogic]With ?term=Spring in the address, the page lists the Spring entries. With no term, or ?term= with nothing after it, it shows the message. To show nothing at all, leave out [else] and the message.
{get} has no default value. To open the page on a chosen value instead, put two embeds of the same View in a [gvlogic] pair. The first runs when {get:term} is empty, the second when it holds a value:
[gvlogic if="{get:term}" is=""]
[gravityview id="12" search_field="5" search_value="Fall"]
[else]
[gravityview id="12" search_field="5" search_value="{get:term}"]
[/gvlogic]Replace 12 with your View's ID and 5 with the ID of the field to search. If the View has a secret, add it to both embeds, as Using the [gravityview] shortcode explains. With no term in the URL, or ?term= with nothing after it, the page lists the Fall entries. With ?term=Spring, it lists the Spring entries.
How {get} displays values #
{get} escapes the value with the esc_html() function, so HTML in the address shows as text and never runs:
- URL data:
?lets-get-dangerous=<script>alert("better watch out")</script> - Merge tag:
{get:lets-get-dangerous} - Output: the page shows the same text,
<script>alert("better watch out")</script>, but the HTML holds<script>alert("better watch out")</script>, so the browser shows it as text and never runs it. To turn this escaping off, use thegravityview/merge_tags/get/esc_html/{parameter}filter listed under Available filters below.
To pass a value on in a link to another page, add :urlencode or :rawurlencode, as in <a href="/staff/?dept={get:dept:urlencode}">. Without one, the value is cut off at the first & or #, and each + becomes a space, so "Research & Development" arrives as "Research". The two modifiers differ only in how they write a space: :urlencode as + and :rawurlencode as %20.
When the parameter holds a web address, such as the page to return to, add :esc_url or :esc_url_raw before you use it in a link, as in <a href="{get:return:esc_url}">Go back</a>. Both print the address when it is safe to link to and print nothing when it isn't, such as an address that starts with javascript:. Without them, {get} prints the address as it is in the URL.
Parameters with named subkeys
When a parameter has subkeys, separate them with a slash. A date range search in the Search Bar, for example, puts both dates in the address:
example.com/view/my-view/?filter_10[start]=10/15/2021&filter_10[end]=12/20/2022
{get:filter_10/start} returns 10/15/2021, and {get:filter_10/end} returns 12/20/2022.
Parameters with several values
When a parameter holds several values, {get} shows them separated by a comma and a space:
- URL data:
?example[]=Example+One&example[]=Example+(with+comma)%2C+Two - Merge tag:
{get:example} - Output:
Example One, Example (with comma), Two
To change the comma and space between the values, use the gravityview/merge_tags/get/glue/ filter below.
Available filters #
Developers can change the output of the {get} merge tag with these filters. In the last two, {parameter} stands for the name of the parameter, such as customer.
gravityview/merge_tags/get/glue/: the text between the values of a parameter that holds several values. The default is a comma and a space. It receives$glueand$property, the name of the parameter.gravityview/merge_tags/get/esc_html/{parameter}: returnfalseto turn off the escaping for that parameter, so HTML in its value is output as HTML. The default istrue, and we recommend leaving the escaping on.gravityview/merge_tags/get/value/{parameter}: changes the value that replaces the merge tag. It receives$value,$text(the text that holds the merge tag),$form, and$entry.
