In WP::parse_request(), don't add query vars of non-viewable post types to WP::public_query_vars. In register_post_type(), don't add query vars of non-viewable post types to WP::public_query_vars.

In `_unregister_post_type()` (unit tests), don't add query vars of non-viewable post types to `WP::public_query_vars`.

Adds unit test.

Fixes #30018.


git-svn-id: https://develop.svn.wordpress.org/trunk@34215 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-15 18:53:12 +00:00
parent 6493d211d2
commit 28426c041c
4 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -362,7 +362,7 @@ function _cleanup_query_vars() {
}
foreach ( get_post_types( array() , 'objects' ) as $t ) {
if ( ! empty( $t->query_var ) )
if ( is_post_type_viewable( $t ) && ! empty( $t->query_var ) )
$GLOBALS['wp']->add_query_var( $t->query_var );
}
}