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.
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. When the address has no such parameter, or has it with nothing after the =, as in ?customer=, the merge tag is replaced with nothing.
You can 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:customer} in the headingNote: 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.
Filtering a View by a value in the address #
As the value of an Advanced Filtering condition, {get} makes the View list only the entries that match the address. This condition, on the Filter & Sort tab of the View’s Settings box, lists the deals of the customer in the address:

On example.com/deals/?customer=Harbor%20Books, the page lists Harbor Books’ deals under the widget’s heading:

Upper and lower case don’t matter, so ?customer=harbor%20books lists the same deals.
When the address has no value
When the address has no customer parameter, or ?customer= has nothing after it, the comparison decides what the View lists:
| Comparison | The View lists |
|---|---|
contains, is not or has none of | Every entry where the field has a value |
Any other comparison, such as is, does not contain, greater than or has any of | No entries |
The View above lists no deals until the address names a customer. A field’s Conditional Logic with the same condition shows the field on the same entries the View would list.
In a list of values, a {get} with no value is left out. Take a Checkboxes field named Services and the condition Services has any of, with {get:service} and Print added as separate values. With no service in the address, the View lists the entries that include Print.
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 address 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. The comparison ignores upper and lower case, so ?term=spring and ?term=SPRING show it too. With any other term, or none, the page 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!”
Embedding a View when the address 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.
In the examples below, 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 every embed, as Using the [gravityview] shortcode explains.
To hide the View or show a message of your own when the address 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]With no term in the address, 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:
- In the address:
?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". Spaces become + with :urlencode and %20 with :rawurlencode.
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 value as it is, javascript: included.
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:
- In the address:
?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.