Make WordPress Core

Ticket #21949: 21949.wp-class

File 21949.wp-class, 1.7 KB (added by wpsmith, 14 years ago)

First pass

Line 
1Index: wp-includes/class-wp.php
2===================================================================
3--- wp-includes/class-wp.php (revision 21531)
4+++ wp-includes/class-wp.php (working copy)
5@@ -286,17 +286,22 @@
6 if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
7 $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
8
9- // Limit publicly queried post_types to those that are publicly_queryable
10- if ( isset( $this->query_vars['post_type']) ) {
11- $queryable_post_types = get_post_types( array('publicly_queryable' => true) );
12- if ( ! is_array( $this->query_vars['post_type'] ) ) {
13- if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
14- unset( $this->query_vars['post_type'] );
15- } else {
16- $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
17+ // Limit publicly queried post_types & taxonomies to those that are publicly_queryable & public respectively
18+ foreach ( array( 'post_type', 'taxonomy', ) as $qv ) {
19+ if ( isset( $this->query_vars[$qv]) ) {
20+ if ( 'post_type' == $qv )
21+ $queryable = get_post_types( array('publicly_queryable' => true) );
22+ else
23+ $queryable = get_taxonomies( array( 'public' => true ) );
24+ if ( ! is_array( $this->query_vars[$qv] ) ) {
25+ if ( ! in_array( $this->query_vars[$qv], $queryable ) )
26+ unset( $this->query_vars[$qv] );
27+ } else {
28+ $this->query_vars[$qv] = array_intersect( $this->query_vars[$qv], $queryable );
29+ }
30 }
31 }
32-
33+
34 foreach ( (array) $this->private_query_vars as $var) {
35 if ( isset($this->extra_query_vars[$var]) )
36 $this->query_vars[$var] = $this->extra_query_vars[$var];