Keeping Views with Prevent Direct Access out of XML sitemaps
An XML sitemap lists your site’s URLs for search engines. A View with Prevent Direct Access on answers 404 at its own URL, so the sitemap shouldn’t list it.
GravityView leaves these Views out of the sitemap WordPress generates. When Yoast SEO generates your sitemap, the Social Sharing & SEO feature of GravityView Pro leaves them out of it too.
Sitemaps that leave these Views out #
- The sitemap WordPress generates: GravityView leaves them out, whether Social Sharing & SEO is on or off.
- Yoast SEO’s sitemap: Social Sharing & SEO leaves them out while it is on. With Social Sharing & SEO off, Yoast SEO lists them.
Neither needs any setup. Turn on Prevent Direct Access for the View, and it drops out of the sitemap. To find the setting, see The Prevent Direct Access setting.
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.
Views that a snippet blocks #
These sitemaps also leave out a View that answers 404 because of code:
- A snippet uses the
gravityview/view/output/directfilter to block the View. - A snippet turns Prevent Direct Access on by default, and the View has no saved value for the setting.
A View saved with the setting off stays public and stays listed, even when the default is on. Keeping Views and entries out of search engines has both snippets.
Check your sitemap #
Open the sitemap for Views and look for the View’s URL:
- WordPress:
/wp-sitemap-posts-gravityview-1.xml - Yoast SEO:
/gravityview-sitemap.xml. While Yoast SEO is active, WordPress’s address redirects there. - Other SEO plugins: open the sitemap index the plugin generates and follow its link for Views.

If the View is still listed, check these in order:
- Open the View and check that Prevent Direct Access is on and saved.
- Go to Plugins and click Features in the GravityView Pro row. In the Social Sharing row, Runs from should say Built into GravityView Pro. If the row has a Turn on button, click it.

- If you changed a snippet that was already in place, the sitemap can take up to an hour to show the change. To show it right away, open any View and click Update.
If the separate Social Sharing & SEO plugin is active on your site, it runs instead of the built-in copy. Moving from separate extensions to GravityView Pro explains how to remove it.
WordPress’s and Yoast SEO’s sitemaps list no entry URLs, because entries are not WordPress posts. To keep entry pages and public Views out of search results, see Keeping Views and entries out of search engines.