How to change where the Go Back link takes visitors
On a Single Entry page, the Go Back link returns the visitor to the Multiple Entries page they came from. You can change the wording of that link from the View editor, and change where it points with a small snippet.
Changing the wording #
Open your View, go to View Settings and select the Single Entry tab. The Back Link Label field sets the text of the link. Leave it empty to use the default, which is an arrow followed by “Go back”. Merge tags are supported here.

Note: this setting changes the text of the link only. There is no setting for the destination, so everything below needs a snippet.
When you do not need a snippet at all #
If the same View is embedded on more than one page, the Go Back link already returns to the page the visitor was actually on. Entry links are built from the page the View is embedded in, and the Go Back link is built the same way, so a visitor who opened an entry from one page goes back to that page and not to the other one. This case needs no code.
Pointing the link at a specific page #
The gravityview/template/links/back/url filter sets the destination. Returning a URL from it sends every Go Back link there.
add_filter( 'gravityview/template/links/back/url', function ( $href ) {
return home_url( '/directory/' );
} );To change it for one View only, ask the filter for its second argument. It carries the View being rendered, so you can compare the View ID and leave every other View alone. Note the 10, 2 at the end: without it the second argument is not passed.
add_filter( 'gravityview/template/links/back/url', function ( $href, $context ) {
if ( ! $context instanceof \GV\Template_Context ) {
return $href;
}
// Replace 123 with the ID of your View.
if ( 123 === (int) $context->view->ID ) {
return home_url( '/directory/' );
}
return $href;
}, 10, 2 );The check on the first line matters. Older templates call the link without that second argument, so it can arrive empty, and reading the View ID from it would cause an error.
Returning visitors to the page they came from #
If visitors reach an entry from somewhere other than the View, a calendar, a dashboard or a link in an email, the Go Back link still points at the View’s Multiple Entries page. The reliable way to change that is to mark where the visitor came from in the link itself, then read that mark on the way back.
Add ?origin=123 to the links that lead to your entries, where 123 is the ID of the page you want people sent back to. GravityView carries that parameter through to the entry, and this snippet turns it into the Go Back destination.
add_filter( 'gravityview/template/links/back/url', function ( $href ) {
if ( empty( $_GET['origin'] ) ) {
return $href;
}
$origin = get_permalink( (int) $_GET['origin'] );
return $origin ? $origin : $href;
} );Using a page ID rather than a full address keeps this safe. Anything that is not a real page is ignored and the link falls back to its normal destination, so a visitor cannot edit the address to send the link somewhere else.
Warning: it is tempting to use the browser’s referrer instead. Avoid it. Browsers do not always send it, it disappears when the page is refreshed or opened from a bookmark, and it can point at another website entirely, which would send your visitors off your site.
Matching the Cancel button on Edit Entry #
The Edit Entry screen has its own Cancel button, which is separate from the Go Back link. It has its own filter, and how much you need to do depends on whether the form has more than one page.
add_filter( 'gravityview/edit_entry/cancel_link', function ( $back_link ) {
return home_url( '/directory/' );
} );
add_filter( 'gravityview/edit_entry/cancel_onclick', '__return_empty_string' );On a form with more than one page, the first filter on its own is enough. On a single page form the button sends the visitor back through their browser history instead, which ignores the address, so the second filter is what makes it take effect. Using both is safe either way.
Removing the link #
Returning nothing at all from the same filter removes the Go Back link from every Single Entry page.
add_filter( 'gravityview/template/links/back/url', '__return_false' );See how to add these code samples to your website: Where to put code samples.