Using the [gventry] shortcode
The [gventry] shortcode shows one entry on a page or post, without the View’s list of entries or a link back to it.
In the block editor, the GravityView Entry block shows an entry the same way, as Embedding Views, entries and fields using blocks explains. For ready-made setups, such as the newest entry or each member’s own entry, see How to show a single entry without the Multiple Entries page.
Displaying an entry #
[gventry entry_id="24" view_id="8"]entry_id is the ID of the entry, and view_id is the ID of the View that shows it. The entry appears with the fields of that View’s Single Entry layout, which Getting Started: Adding Fields to the Multiple Entries and Single Entry Pages shows how to set up.

To find an entry’s ID, go to Forms, then Entries, choose the form, and click View under the entry. The ID is next to Entry Id in the Entry box:

A page can hold several [gventry] shortcodes, one for each entry.
Adding the View’s secret
A new View has Enable Enhanced Security turned on, so the shortcode also needs the View’s secret:
[gventry entry_id="24" view_id="8" secret="7d62586b9383"]The View’s ID and secret are in Embed Shortcode, in the View editor’s Publish box, as Using the [gravityview] shortcode shows. The samples on the rest of this page leave the secret out to stay short.
Without the right secret, visitors see nothing where the entry should be. Administrators see a message with the secret to add, and a notice on the WordPress Dashboard names the page. Enable Enhanced Security: the secret attribute for shortcodes explains the setting.
Displaying the first or last entry #
[gventry entry_id="first" view_id="8"]first shows the entry the View lists first, and last shows the one it lists last. The View’s sort order and filters decide which entry that is.
A new View sorts its entries by entry ID, oldest first, so last shows the newest entry. To show the newest entry with first, open the View’s Filter & Sort settings tab, choose Date Created under Sort by field and Descending under Sort direction, then click Update.
Choosing the entry from the page address #
[gventry entry_id="{get:member}" view_id="8"]The {get} merge tag fills entry_id from the page address. On example.com/member-profile/?member=24, this shows entry 24, and with no member in the address it shows nothing.
Visitors can change the number in the address and open any other entry the View lists. How to show a single entry without the Multiple Entries page covers this setup, and The {get} merge tag explains the merge tag.
Showing the Edit Entry form #
[gventry entry_id="24" view_id="8" edit="1"]edit="1" shows the entry’s Edit Entry form in place of the entry. A user allowed to edit the entry gets the form, and everyone else sees “You do not have permission to edit this entry.” Embedding the Edit Entry form in a page or post shows the View settings that let users edit their own entries.
With edit="1", the View’s filter conditions don’t apply, so a user allowed to edit an entry gets its form even when the View leaves that entry out. Show only approved entries still applies: on a View with that setting on, an unapproved entry shows nothing.
If the View has an Edit Window, its deadline applies here too. Once it passes, the entry’s owner sees “The deadline for editing this entry has passed.”, while users who can edit other users’ entries still get the form. Setting an editing deadline with Edit Window explains the setting.
When the shortcode shows nothing #
The shortcode shows an entry only when its View lists that entry. Visitors see nothing in its place when:
- The View’s filter conditions leave the entry out.
- The entry isn’t approved and the View has Show only approved entries on. Administrators then see the entry only if Show all entries to administrators is on too.
- The entry is in the trash or marked as spam.
- The entry comes from a different form than the View’s.
- The View is a draft or private. Administrators still see the entry.
- The secret is missing or wrong.
On a password-protected View, the shortcode shows the password form in place of the entry, to administrators too.
Using the shortcode in a Custom Content field #
The shortcode also works in a Custom Content field of a View. An entry shown through the same View needs no secret. Through another View, the shortcode needs that View’s secret whenever it has Enable Enhanced Security on.
Using the Custom Content field explains the field.
Shortcode parameters #
| Parameter | What it does |
|---|---|
entry_id | The ID of the entry, or first or last for the entry the View lists first or last. It takes the {get} merge tag. id works in its place. Required. |
view_id | The ID of the View that shows the entry. Its Single Entry layout, filters and approval settings decide what the shortcode shows. With edit="1", the filters don’t apply. Required. |
secret | The View’s secret. The shortcode needs it when the View has Enable Enhanced Security on, and Embed Shortcode in the View editor includes it. |
edit | 1 shows the entry’s Edit Entry form in place of the entry. |
Filters for developers #
Replacing what the shortcode shows
The gravityview/shortcodes/gventry/output filter changes the HTML the shortcode returns. This sample shows logged-out visitors a Log in link where View 12’s entries would be:
// Show logged-out visitors a "Log in" link in place of View 12's entries.
add_filter( 'gravityview/shortcodes/gventry/output', function ( $output, $view ) {
if ( $view && 12 === (int) $view->ID && ! is_user_logged_in() ) {
return wp_loginout( get_permalink(), false );
}
return $output;
}, 10, 2 );The link opens the WordPress login page. gravityview/shortcodes/gventry/output on gravitykit.dev lists the filter’s parameters.
Note: Adding custom PHP code snippets to your website shows where to put the samples on this page.
Changing the shortcode’s parameters
The gravityview/shortcodes/gventry/atts filter changes the parameters before the shortcode uses them. On View 12, this sample shows each signed-in user the entry whose ID is saved in their listing_entry_id user meta:
// Show signed-in users the entry saved in their listing_entry_id user meta.
add_filter( 'gravityview/shortcodes/gventry/atts', function ( $atts ) {
if ( 12 === (int) $atts['view_id'] && is_user_logged_in() ) {
$user_id = get_current_user_id();
$atts['entry_id'] = get_user_meta( $user_id, 'listing_entry_id', true );
}
return $atts;
} );A signed-in user with no listing_entry_id sees nothing when the page’s shortcode is written with entry_id, and visitors see the entry the shortcode names. Set entry_id in the filter, since the shortcode reads id only when entry_id is empty. Its parameters are on gravityview/shortcodes/gventry/atts.
Changing the message after an update
After someone updates an entry through [gventry edit="1"], the page shows the message “Entry Updated. Return to Entry.” The gravityview/shortcodes/gventry/edit/success filter replaces it.