Ticket #17040: 17040.diff
File 17040.diff, 2.6 KB (added by , 13 years ago) |
---|
-
wp-includes/class-wp.php
25 25 * @since 2.0.0 26 26 * @var array 27 27 */ 28 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_ type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in');28 var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in'); 29 29 30 30 /** 31 31 * Extra query variables set by the user. … … 277 277 if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) ) 278 278 $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] ); 279 279 280 // Limit publicly queried post_types to those that are publicly_queryable 281 if ( isset( $this->query_vars['post_type']) ) { 282 $queryable_post_types = get_post_types( array('publicly_queryable' => true) ); 283 if ( ! is_array( $this->query_vars['post_type'] ) ) { 284 if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) 285 unset( $this->query_vars['post_type'] ); 286 } else { 287 $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types ); 280 if ( isset( $this->query_vars['post_type'] ) ) { 281 // Limit publicly queried post_types to those that are publicly_queryable 282 $queried_post_types = array_intersect( 283 (array) $this->query_vars['post_type'], 284 get_post_types( array( 'publicly_queryable' => true ) ) 285 ); 286 287 // Limit post type archives to those with has_archive 288 if ( !is_admin() && !empty( $queried_post_types ) && !isset( $this->query_vars['name'] ) ) { 289 $valid_ptypes = array(); 290 foreach( $queried_post_types as $ptype ) { 291 if ( get_post_type_object( $ptype )->has_archive ) 292 $valid_ptypes[] = $ptype; 293 } 294 $queried_post_types = $valid_ptypes; 288 295 } 296 297 if ( empty( $queried_post_types ) ) 298 unset( $this->query_vars['post_type'] ); 299 elseif ( is_array( $this->query_vars['post_type'] ) ) 300 $this->query_vars['post_type'] = $queried_post_types; 301 else 302 $this->query_vars['post_type'] = $queried_post_types[0]; 289 303 } 290 304 291 305 foreach ( (array) $this->private_query_vars as $var) {