Sitemaps: Exclude post types and taxonomies that are not publicly queryable.

Props Cybr.
Fixes #50607.

git-svn-id: https://develop.svn.wordpress.org/trunk@48474 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2020-07-14 11:54:49 +00:00
parent fa9e258750
commit efb0b58598
4 changed files with 88 additions and 4 deletions

View File

@@ -37,6 +37,8 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
$post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] );
$post_types = array_filter( $post_types, 'is_post_type_viewable' );
/**
* Filters the list of post object sub types available within the sitemap.
*

View File

@@ -35,6 +35,8 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
public function get_object_subtypes() {
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
$taxonomies = array_filter( $taxonomies, 'is_taxonomy_viewable' );
/**
* Filter the list of taxonomy object subtypes available within the sitemap.
*