The [gv_entry_link] Shortcode

Added in Version 1.15

Use the [gv_entry_link] to generate links to an entry. The shortcodes function in post or page content, as well as in a View. You can use the shortcode to generate links to edit or delete an entry.

Edit & Delete

The current user must have permission to edit or delete the entry to see the links. If the user is not logged in or does not have permission to edit or delete the entry, the shortcode will display nothing.

Shortcode attributes:

These attributes apply to both the Edit and Delete shortcodes:

  • action - Define which type of link you want to display. Default: read
    • read - Link to the entry. Default link text: View Details
    • edit - Link to edit the entry. Default link text: Edit Entry
    • delete - Link to the delete the entry. Default text: Delete Entry
  • view_id - Required. The ID for the View where the entry is displayed. Default: Uses the current View ID (if shortcode is used inside a View)
  • entry_id - Required. ID of the entry to edit. Default: Uses the current Entry ID (if shortcode is used inside a View)
  • post_id - If you want to have the Edit Entry link go to an embedded View, pass the ID of the post or page where the View is embedded. Default: (empty)
  • return - What should the shortcode return: link HTML (html) or the URL (url). Default: html
  • link_atts - Attributes to pass to the link tag generator to add to the <a> tag. Only used when return is not url. See below for examples. Default: (empty)
  • field_values - Parameters to pass URL arguments to the link. Can be used to pass field values to Edit Entry (see Pass default field values). Default: (empty)


Link to a specific entry

If you are writing a post or page and want to link to a specific entry, you will need to know the View ID and the Entry ID.

Let's say you want to link to a florist shop's entry, which is displayed in View #2 and has the Entry ID of #123. Here is the shortcode you could use:

[gv_entry_link entry_id="123" view_id="2"]See Flower Power's profile![/gv_entry_link]

It would display like this:

<a href="[link to single entry]">See Flower Power's profile!</a>

Edit a specific entry

If you want to generate a link to edit a specific entry, you will need to populate the entry_id attribute.

This shortcode will generate a link to edit an entry with ID of 123 in a View with an ID of 2.

[gv_entry_link action="edit" entry_id="123" view_id="2" /]

Open links in a new window

In the example below, we also define a custom class attribute and set the value to my_custom_css_class.

[gv_entry_link action="edit" link_atts="target=_blank&class=my_custom_css_class" /]

Will result in the following output:

<a href="[link to edit entry]" target="_blank" class="my_custom_css_class">Edit Entry</a>

Display the URL, not a HTML anchor tag

This shortcode will return the default HTML anchor tag:

[gv_entry_link /]
[gv_entry_link action="edit" /]
[gv_entry_link action="delete" /]

Results in the following output:

<a href="[link to single entry]">View Details</a>
<a href="[link to edit entry]">Edit Entry</a>
<a href="[link to delete entry]">Delete Entry</a>

If you want just the URL of the link, you can use:

[gv_entry_link action="edit" return="url" /]

Which will return just the edit entry URL itself, like this:

Changing the link text

If you want to use different text, you can surround the new text with the [gv_entry_link] tag.

This code:

[gv_entry_link]Link to Entry[/gv_entry_link]
[gv_entry_link action="edit"]Modify this Entry[/gv_entry_link]
[gv_entry_link action="delete"]Remove this Entry[/gv_entry_link]

Will result in the following output:

<a href="[link to entry]">Link to Entry</a>
<a href="[link to edit entry]">Modify this Entry</a>
<a href="[link to delete entry]">Remove this Entry</a>

Pass additional information in the URL

If you want to add additional information to the URL, you can do that using the field_values attribute. It can be used to pass default field values to Edit Entry (see "Pass default field values" below). It's also a powerful tool that can be combined with the {get} Merge Tag.

This code:

[gv_entry_link field_values="first-name=Floaty" /]

Will result in the following output:

<a href="[link to entry]?first-name=Floaty">View Details</a>

You can then display the first-name value on the View Details page by following this how-to.

Pass default field values

If you have "Allow field to be populated dynamically" enabled for your Gravity Forms form fields, you will be able to pass default values to empty fields. Existing field values will not be overwritten, only empty or default values. Learn more about dynamic field population.

Here's an example of how it looks:

[gv_entry_link action="edit" field_values="parameter_name=val&meter_name2=val" /]

[gv_edit_entry_link] and [gv_delete_entry_link] Shortcodes

Added in Version 1.9.2, the [gv_edit_entry_link] and [gv_delete_entry_link] shortcodes were used to generate Edit and Delete links.

  • [gv_edit_entry_link] is the same as [gv_entry_link action="edit"]
  • [gv_delete_entry_link] is the same as [gv_entry_link action="delete"]

These shortcodes do not need to be replaced, and will continue to function in future releases.