Using the [gravityview] shortcode
The [gravityview] shortcode embeds a View on a page or post. Its parameters filter, sort, and limit the entries that embed shows, so one View can list different entries on different pages.
Tutorial video #
Common use cases #
Displaying a View
To display a View, give the shortcode the View’s ID:
[gravityview id="8"]The View editor shows the shortcode under Embed Shortcode in the Publish box. Click the box to copy it.

Then edit the page or post, add a Shortcode block, and paste the shortcode into it. Publish or update the page to show the View.

To embed a View without a shortcode, use the GravityView View block, as Embedding a View on a page or post shows.
A new View has Enable Enhanced Security turned on, so the shortcode there also holds the View’s secret. Keep the secret when you add the parameters below, after the View ID. The samples on this page leave it out to stay short.
Without the right secret, visitors see nothing where the View should be. People who can edit the View see a message with the secret to add, and administrators also get a notice on the WordPress Dashboard that names the page. Enable Enhanced Security: the secret attribute for shortcodes explains the setting.
Displaying entries that contain a specific value
[gravityview id="8" search_field="4" search_value="Silver Member"]This lists the entries whose field 4 contains “Silver Member”. search_field is the ID of the field to search, and search_value is the value to look for.
To find a field’s ID, open the form in the Gravity Forms editor and click the field. The ID shows at the top of Field Settings:

Each part of an Address field has an ID of its own, made of the field’s ID and a number after a dot. On an Address field with ID 5, 5.3 is the city and 5.6 the country.
Sorting entries by a field
[gravityview id="8" sort_field="4" sort_direction="DESC"]This lists the entries by field 4 in descending order, such as Z to A for text. The field doesn’t have to be one the View shows.
sort_direction takes ASC (ascending), DESC (descending), or RAND (random order). With sort_field and no sort_direction, the entries are sorted in ascending order.
Always include sort_field when you set sort_direction, also for RAND. Without it, the View keeps its own order.
To sort by the date entries were submitted or by entry ID, use sort_field="date_created" or sort_field="id". For example, sort_field="date_created" sort_direction="DESC" lists the newest entries first.
To let visitors sort a Table View by clicking its column headings, add sort_columns="1".
Limiting entries by date created
[gravityview id="8" start_date="2026-10-01" end_date="2026-10-31"]This lists the entries submitted from October 1 to October 31, 2026, both days included. Write dates as YYYY-MM-DD, or use relative dates, as Using relative Start Dates and End Dates explains:
[gravityview id="8" start_date="-1month" end_date="today"]This lists the entries submitted in the last month.
Advanced use cases #
Filtering a View with a search operator
search_operator changes how search_value is compared. This lists the entries whose field 2 isn’t “Oslo”:
[gravityview id="8" search_field="2" search_value="Oslo" search_operator="isnot"]search_operator accepts these values:
is: the field holds exactly the value.isnotor<>: the field holds anything else, or nothing.contains, the default: the field holds the value anywhere.like: the field matches a pattern where%stands for any text, as insearch_value="Base%".starts_withandends_with: the field starts or ends with the value.inandnot in: the field holds one of several values, or none of them. Separate the values with commas, as insearch_value="Soccer, Tennis", orsearch_value="2,5"on a Number field.>,<,>=, and<=: the field is greater than, less than, greater than or equal to, or less than or equal to the value.
Any other value works as contains.
On a text field, isnot compares the whole value, so leaving out “Baseball” keeps an entry that holds “Baseball coaching”. Use isnot together with search_field. Without it, an entry is listed when any of its fields differs from the value, which is nearly every entry.
Pre-filtering results on a View shows how to also leave out the entries with nothing in the field, and how visitors can leave a value out from the Search Bar.
On a Multi Select or Checkboxes field, in, not in, isnot and <> compare each option a person chose with the values. This lists the members whose Sports field, with ID 3, has Soccer, Tennis or both chosen:
[gravityview id="8" search_field="3" search_operator="in" search_value="Soccer, Tennis"]The other operators compare the chosen options the same way:
not inwith the same values leaves out everyone who chose Soccer or Tennis.isnotor<>with one value, such assearch_value="Soccer", leaves out everyone who chose Soccer.inwith one value, such assearch_value="Tennis", lists everyone who chose Tennis.
Entries with nothing chosen stay in with not in, isnot and <>.
Displaying entries created by a specific user
[gravityview id="8" search_field="created_by" search_operator="is" search_value="5"]This lists the entries created by the user with ID 5. A user’s ID is in the address of their profile page under Users, as in user-edit.php?user_id=5.
Keep search_operator="is". Without it, the value is found anywhere in the ID, so search_value="1" also lists the entries of users 130 and 131.
Displaying entries created by the logged-in user
To list the entries of whoever is viewing the page, set search_value to the {user:ID} merge tag, which is the ID of the logged-in user:
[gravityview id="8" search_field="created_by" search_operator="is" search_value="{user:ID}"]Logged-out visitors see no entries. Keep search_operator="is" here too. Without it, the user with ID 3 also sees the entries of users 130 and 131.
Showing user details with the {created_by} and {user} merge tags explains the {user} merge tag. To filter the View itself, on every page that shows it, see How to show only entries created by the currently logged-in user.
Filtering by a value in the page address
[gravityview id="8" search_field="2" search_value="{get:city}"]The {get} merge tag fills search_value from the page address. On example.com/members/?city=Denver, this lists the entries whose field 2 contains “Denver”.
When the address has no city parameter, {get:city} comes out empty and the View lists every entry. Administrators then get a notice on the WordPress Dashboard that names the page.
Add search_value_empty="none" to list no entries in that case, or search_value_empty="all" to keep every entry and hide the notice. To hide the View or show a message of your own when the value is missing, put the shortcode inside a [gvlogic] condition, as The {get} merge tag shows.
Displaying details about a View #
The detail parameter shows a number about a View in place of its entries. Always include the View’s id: in a Custom Content field of the same View, detail without it shows nothing.
In the block editor, the GravityView View Details block shows the same numbers, as Using the GravityView View Details block explains.
Displaying the total number of entries in a View
[gravityview id="8" detail="total_entries"]This shows how many entries the View lists across all its pages, with the shortcode’s other parameters applied.
Displaying the total number of approved entries
To count only the approved entries, add show_only_approved="1". It counts the approved entries also when the View itself shows entries of every status:
[gravityview id="8" detail="total_entries" show_only_approved="1"]To count disapproved entries, use search_field="is_approved" search_value="2", and search_value="3" for unapproved entries. These two counts need Show only approved entries off, since with it on both come out as 0. To leave the View’s setting on, add show_only_approved="0" to the shortcode.
Getting Started: GravityView Entry Approval explains the approval statuses.
Displaying the page size
To show how many entries the View lists per page, use detail="page_size":
[gravityview id="8" detail="page_size"]This shows the View’s page size, such as 25, also when the View has fewer entries than that.
Shortcode parameters #
| Parameter | What it does |
|---|---|
id or view_id | The ID of the View to display. Required. |
secret | The View’s secret, required when the View has Enable Enhanced Security on. Embed Shortcode includes it. |
search_field | The ID of the field to search, created_by for the user who created the entry, or is_approved for the approval status. One field only. |
search_value | The value to look for. It takes merge tags, such as {get:city} and {user:ID}. |
search_operator | How the value is compared. The default is contains. See Filtering a View with a search operator. |
search_value_empty | What to show when search_value is a merge tag that comes out empty: none shows no entries, and all shows every entry. Without it, every entry is shown and administrators get a notice on the Dashboard. |
start_date | Lists only the entries submitted on or after this date, as YYYY-MM-DD or a relative date. |
end_date | Lists only the entries submitted on or before this date. |
sort_field | The field to sort by: a field ID, id for the entry ID, or date_created for the date the entry was submitted. |
sort_direction | ASC, DESC, or RAND. Use it together with sort_field. |
sort_columns | 1 lets visitors sort a Table View by clicking a column heading. |
show_only_approved | 1 lists only approved entries, and 0 lists entries of every status, whatever the View’s own setting. |
page_size | The number of entries per page. Without it, the View uses the number on its Multiple Entries settings tab. -1 shows all entries. |
offset | The number of entries to skip. With offset="2", the View starts at the third entry. |
detail | Shows total_entries or page_size in place of the entries. See Displaying details about a View. |
class | Adds a CSS class to the View’s container, the element with the gv-container class. |
single_title | The title of the Single Entry page, in place of the page’s own title. It takes merge tags, such as {Name:1}. |
back_link_label | The text of the link back from the Single Entry page. The default is ← Go back. |
| Other View settings | The shortcode takes them by their key, such as no_results_text="No members in this city yet." for the message shown when no entries match. Changing the default View settings lists each key. |
Shortcode limitations #
The shortcode searches one field at a time, and search_field="2,3" lists no entries. To filter by several fields, with AND or OR, use Advanced Filtering on the View. Getting started with Advanced Filtering shows how.
Advanced Filtering is built into GravityView Pro. To turn it on or off, go to Plugins and click Features in the GravityView Pro row.
To let visitors narrow the entries themselves, add a Search Bar or turn on Live Filters in the View. Both work only within the entries the shortcode lets through. Configuring the Search Bar widget and Adding Live Filters to a View explain them.