Keeping Views and entries out of search engines
GravityView adds no noindex tag or header to its pages, so search engines can index a public View and its entry pages like any other page. A noindex tag or header asks search engines to leave a page out of their results.
Prevent Direct Access blocks a View’s own URL and keeps it out of your sitemap. Entry pages under the page that embeds the View stay public, and a noindex header keeps them out of search results.
A noindex header doesn’t stop someone who has the page’s link, so limit who can see data that must stay private. Noindex and robots.txt are requests that search engines choose to follow, and scrapers can ignore them. Bots and scrapers that ignore these rules shows what limits them.
Block the View’s own URL #
Every View is a WordPress post with a URL of its own, /view/your-view-name/ by default, whether or not you link to it. To block that URL:
- Edit the View.
- In the Settings box, open the Permissions tab.
- Turn on Prevent Direct Access.
- Click Update.

The View keeps working on pages that embed it. At its own URL, visitors and search engines get your theme’s 404 page, the same as for an address that does not exist.
The setting also closes the View’s other public routes:
- Its REST API endpoints answer 403.
- Its CSV and TSV export URLs answer 404.
- WordPress’s oEmbed endpoint returns no embed code for it.
- The Export Link widget is hidden from visitors on the page that embeds the View.
Administrators and editors still see the View at its own URL while signed in, so check the setting from a private browser window.
Turning it on for every new View
To have Prevent Direct Access on for every View you create from now on, add this snippet, which uses the gravityview/view/settings/defaults filter:
/**
* Turns on Prevent Direct Access by default for new Views.
*
* @param array $defaults The default View settings.
*
* @return array The changed default settings.
*/
add_filter( 'gravityview/view/settings/defaults', function ( $defaults ) {
$defaults['embed_only']['value'] = true;
return $defaults;
} );Note: Adding custom PHP code snippets to your website explains where this code goes.
Existing Views keep the value they were saved with, so turn the setting on for each of them. Changing the default View settings lists the other settings this filter can change.
Deciding in code instead
To block Views by your own rules, use the gravityview/view/output/direct filter. When your callback returns false, GravityView blocks the View’s own URL and the same routes the setting closes. This example blocks the View with ID 123:
/**
* Blocks the View with ID 123 at its own URL.
*
* The View keeps working where you embed it. Change 123 to your View's ID.
*
* @param bool $allowed Whether the View can be opened at its own URL.
* @param \GV\View $view The View being requested.
* @param \GV\Request $request The current request.
*
* @return bool Whether the View can be opened at its own URL.
*/
add_filter( 'gravityview/view/output/direct', function ( $allowed, $view, $request ) {
return $view && 123 === $view->ID ? false : $allowed;
}, 10, 3 );Note: Adding custom PHP code snippets to your website explains where this code goes.
A View blocked here still displays where you embed it, and its entries open there. If your snippet uses the older gravityview_direct_access filter, Deprecated and renamed hooks shows its replacement.
Keep Views out of your sitemap #
An XML sitemap lists your site’s URLs for search engines, Views included, whether or not anything links to them. GravityView leaves a View out of the sitemap WordPress generates when Prevent Direct Access is on or when a snippet blocks the View.
When Yoast SEO generates your sitemap instead, Social Sharing & SEO leaves the same Views out of it. With Social Sharing & SEO off, Yoast SEO lists them.
Social Sharing & SEO is built into GravityView Pro. To turn it on or off, go to Plugins and click Features in the GravityView Pro row.
On a GravityView + Extensions (Legacy) license, Social Sharing & SEO is a separate plugin. About the “GravityView + Extensions (Legacy)” license shows how to install it.
Keeping Views with Prevent Direct Access out of XML sitemaps shows where to check each sitemap.
Keep a public View out of search results #
A View can stay public at its own URL and still be kept out of search results. In Yoast SEO, the setting for the Views content type does this for every View on the site:
- Go to Yoast SEO, then Settings.
- Under Content types, click Views.
- Turn off Show views in search results.

- Click Save changes.
Yoast SEO then marks each View’s URL and the entry URLs under it as noindex, and leaves Views out of its sitemap. Pages that embed a View, and their entry pages, stay indexable.
Keep entry pages out of search results #
An entry’s page has an address under the page that embeds the View, such as /volunteers/entry/12/, so it stays public when the View’s own URL is blocked. Search engines can reach it through the links in the View, even though WordPress’s and Yoast SEO’s sitemaps leave entry pages out.
Warning: noindex keeps a page out of search results, and anyone with the link can still open it. Limit who can see the entries when the data must stay private. See Restricting a View to logged-in users or user roles or How to show only entries created by the currently logged-in user.
This snippet sends a noindex header on the entry pages of every View on your site, and leaves the list pages alone. Skip it if a public directory’s entry pages should stay in search results.
/**
* Asks search engines not to index GravityView entry pages.
*
* Sends a noindex header on every entry page, under a page that embeds a View
* and at a View's own URL. List pages are not affected.
*/
add_action( 'template_redirect', function () {
if ( function_exists( 'gravityview' ) && gravityview()->request->is_entry() ) {
header( 'X-Robots-Tag: noindex' );
}
} );Note: Adding custom PHP code snippets to your website explains where this code goes.
To check it, clear any page cache and run this command with one of your entry URLs. The response should include X-Robots-Tag: noindex.
curl -I https://example.com/volunteers/entry/12/Google drops a page from its results once it crawls the page again and sees the header, as Google’s guide to noindex explains. Crawlers must be able to fetch the page to see the header, so don’t also block these URLs in robots.txt.
Keep Magic Links edit and delete pages out of search results #
On a View with Magic Links, logged-out visitors see the View’s Edit links, and its Delete links when Allow Entry Deletion is on. Search engines see them too. Neither GravityView nor Magic Links marks the pages those links open as noindex.
Yoast SEO marks these pages index, follow. Without an SEO plugin, WordPress’s own robots tag has no noindex either.
Each of these pages has a query string in its address:
- Request Edit Access, opened from an Edit link: the entry’s address with
editandgvid, such as/members/entry/12/?edit=3699ab890b&gvid=758. - Request Delete Access, opened from a Delete link: the address of the page that embeds the View, with
action=delete,entry_id, andgvid. - The pages a magic link opens: their addresses add
gv_magicandgv_email.
The entry page snippet above covers the pages on an entry’s address. The delete pages are on the address of the page that embeds the View, so that snippet misses them. This snippet covers all of them and leaves the View and its entry pages indexable:
/**
* Asks search engines not to index the edit and delete pages that
* Magic Links shows, and browsers and page caches not to store them.
* Entry pages and the View itself are not affected.
*/
add_action( 'wp', function () {
$params = array( 'gv_magic', 'gv_email' );
// Magic Links 1.3.0 and newer can rename its parameters.
$magic_links = '\GravityKit\GravityView\MagicLinks\Handler';
if ( method_exists( $magic_links, 'get_token_param_name' ) ) {
$params[] = $magic_links::get_token_param_name();
$params[] = $magic_links::get_email_param_name();
}
$is_magic_link = array_intersect( $params, array_keys( $_GET ) );
$is_edit = isset( $_GET['edit'] )
&& function_exists( 'gravityview' )
&& gravityview()->request->is_entry();
$is_delete = isset( $_GET['action'], $_GET['entry_id'] )
&& 'delete' === $_GET['action'];
if ( $is_magic_link || $is_edit || $is_delete ) {
header( 'X-Robots-Tag: noindex' );
nocache_headers();
}
}, 1 ); // Priority 1 runs before Magic Links shows its delete page.Note: Adding custom PHP code snippets to your website explains where this code goes.
The snippet also sends WordPress’s no-cache headers, because a stored copy of these pages stops working within a day.
The Request Edit Access and Request Delete Access forms include a security token that works for 12 to 24 hours after the page is made. On an older copy, clicking Request Access shows “An error occurred. Please try again.” and no link is sent.
If your site uses a page cache plugin, also keep addresses that contain gvid= or gv_magic= out of its cache. Magic Links sends no-cache headers itself only on the edit form a magic link opens, and only when One-Time Access is on.
Magic Links can rename gv_magic and gv_email, as Magic Links filters shows. The snippet reads the names Magic Links uses, and still covers the default names.
To check it, clear any page cache, copy the address of a Delete link from the View in a private browser window, and run this command with it. The response should include X-Robots-Tag: noindex.
curl -I "https://example.com/members/?action=delete&entry_id=12&gvid=8"Ask crawlers not to fetch entry URLs #
A robots.txt rule asks search engines not to crawl entry pages, which suits a site that wants fewer crawler requests. It doesn’t remove a page that’s already in search results.
Warning: Anyone can still open these pages, and the file is public, so it shows the paths you want hidden. Google’s introduction to robots.txt says a blocked URL that other pages link to can still appear in its results, without a description.
To add the rule, put these lines in the robots.txt file in your site’s root folder:
User-agent: *
Disallow: /*/entry/
Disallow: /entry/The second Disallow line covers a View embedded on your home page, whose entries are at /entry/12/. If you changed the Entry Endpoint in GravityView’s permalink settings, use your endpoint in place of entry. Customizing View URLs shows where that setting is.
When the root folder has no robots.txt file, WordPress generates one. A file you create replaces it, so first copy in the lines WordPress shows at /robots.txt on your site.
Bots and scrapers that ignore these rules #
A bot that copies a public directory can ignore noindex and robots.txt and request every list page, entry page and photo. GravityView has no setting that limits how many pages or files one visitor can request, so the limit has to come from your server or from a service in front of it:
- Ask your host whether it can limit how many requests one IP address makes, or block the IP addresses that show up most in your server logs.
- A firewall service in front of your site, such as Cloudflare, can block or challenge bots before their requests reach your server. Its free plan includes Bot Fight Mode, which challenges traffic it detects as bots and may also challenge API or mobile app traffic, and one rate limiting rule, which blocks a visitor who goes over the number of requests you set.
- A security plugin such as Wordfence can limit how many pages visitors and crawlers open per minute, and throttle or block those who go over the limit, as Wordfence’s Rate Limiting help explains. It runs on your own server, so each request still reaches your site before Wordfence decides.
Prevent Direct Access doesn’t stop a scraper. It closes the View’s own URL, and the page that embeds the View, its entry pages and the files they show stay public.
Lower the cost of each copied page
On a View that shows photos or other uploaded files, each file loads through its own secure address, which starts with /gk-download/. Each time WordPress builds the page, GravityView makes new addresses, and opening each one starts WordPress again. A page of 25 listings with a photo each then costs 26 requests that run WordPress.
A page cache that stores the page serves the same addresses until its copy is rebuilt. Browsers and caches can keep each photo for up to an hour, under that one address.
Turn on Use Direct File Path for Media for the photo field in both the Multiple Entries and Single Entry layouts. Your web server then sends the photos straight from the uploads folder without starting WordPress, and their addresses stay the same.
Using direct file paths for uploaded media in GravityView has the steps. A direct address never expires, so leave the setting off for files that must stay private.
A smaller page size spreads the listings over more pages, so one visit costs less. Copying the whole directory costs the same: a bot loads each photo on its list page, again on each entry page it opens, and again for each photo link it follows.
Showing a directory only to signed-in users keeps its pages from bots that don’t sign in, as Restricting a View to logged-in users or user roles explains. A secure file address copied from the page still opens without signing in, for an hour after the page was built.