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

Props Cybr.
Fixes #50607.
Built from https://develop.svn.wordpress.org/trunk@48474


git-svn-id: http://core.svn.wordpress.org/trunk@48243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2020-07-14 11:57:06 +00:00
parent 4ff1233e75
commit acca036e88
3 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,8 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
$post_types = get_post_types( array( 'public' => true ), 'objects' ); $post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] ); 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. * 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() { public function get_object_subtypes() {
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); $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. * Filter the list of taxonomy object subtypes available within the sitemap.
* *

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta1-48473'; $wp_version = '5.5-beta1-48474';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.