diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index 4a3b42c795..0f86251676 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -311,12 +311,10 @@ class WP { // Don't allow non-public taxonomies to be queried from the front-end. if ( ! is_admin() ) { foreach ( get_taxonomies( array( 'public' => false ), 'objects' ) as $taxonomy => $t ) { - // Check first for taxonomy-specific query_var. - if ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) { - unset( $this->query_vars[ $t->query_var ] ); - } - - // Next, check the 'taxonomy' query_var. + /* + * Disallow when set to the 'taxonomy' query var. + * Non-public taxonomies cannot register custom query vars. See register_taxonomy(). + */ if ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) { unset( $this->query_vars['taxonomy'], $this->query_vars['term'] ); } diff --git a/wp-includes/taxonomy-functions.php b/wp-includes/taxonomy-functions.php index 6c4a0b5b7e..891951bb9e 100644 --- a/wp-includes/taxonomy-functions.php +++ b/wp-includes/taxonomy-functions.php @@ -384,7 +384,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { return new WP_Error( 'taxonomy_length_invalid', __( 'Taxonomy names must be between 1 and 32 characters in length.' ) ); } - if ( false !== $args['query_var'] && ! empty( $wp ) ) { + if ( false !== $args['query_var'] && false !== $args['public'] && ! empty( $wp ) ) { if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy; else diff --git a/wp-includes/version.php b/wp-includes/version.php index 88c55b26bd..9f46b8468b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35332'; +$wp_version = '4.4-alpha-35333'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.