289 | | // Limit publicly queried post_types to those that are publicly_queryable |
290 | | if ( isset( $this->query_vars['post_type']) ) { |
291 | | $queryable_post_types = get_post_types( array('publicly_queryable' => true) ); |
292 | | if ( ! is_array( $this->query_vars['post_type'] ) ) { |
293 | | if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) |
294 | | unset( $this->query_vars['post_type'] ); |
295 | | } else { |
296 | | $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types ); |
| 289 | // Limit publicly queried post_types & taxonomies to those that are publicly_queryable & public respectively |
| 290 | foreach ( array( 'post_type', 'taxonomy', ) as $qv ) { |
| 291 | if ( isset( $this->query_vars[$qv]) ) { |
| 292 | if ( 'post_type' == $qv ) |
| 293 | $queryable = get_post_types( array('publicly_queryable' => true) ); |
| 294 | else |
| 295 | $queryable = get_taxonomies( array( 'public' => true ) ); |
| 296 | if ( ! is_array( $this->query_vars[$qv] ) ) { |
| 297 | if ( ! in_array( $this->query_vars[$qv], $queryable ) ) |
| 298 | unset( $this->query_vars[$qv] ); |
| 299 | } else { |
| 300 | $this->query_vars[$qv] = array_intersect( $this->query_vars[$qv], $queryable ); |
| 301 | } |