Make WordPress Core

Ticket #21949: 21949.1.diff

File 21949.1.diff, 1.7 KB (added by ericlewis, 12 years ago)
  • wp-includes/class-wp.php

     
    279279                        }
    280280                }
    281281
    282                 // Convert urldecoded spaces back into +
    283                 foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
    284                         if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
    285                                 $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
     282                foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
     283                        if ( $taxonomy->query_var && isset( $this->query_vars[ $taxonomy->query_var ] ) ) {
     284                                // Don't allow non-public taxonomies to be queried outside the admin
     285                                if ( ! $taxonomy->public && ! is_admin() )
     286                                        unset( $this->query_vars[ $taxonomy->query_var ] );
     287                        }
     288                }
    286289
     290                // Don't allow non-public taxonomies to be queried outside the admin
     291                if ( isset( $this->query_vars['taxonomy'] ) && ! is_admin() ) {
     292                        $queryable_taxonomies = get_taxonomies( array( 'public' => true ) );
     293                        if ( is_array( $this->query_vars['taxonomy'] ) ) {
     294                                $this->query_vars['taxonomy'] = array_intersect( $this->query_vars['taxonomy'], $queryable_taxonomies );
     295                                if ( empty( $this->query_vars['taxonomy'] ) )
     296                                        unset( $this->query_vars['taxonomy'], $this->query_vars['term'] );
     297                        } elseif ( ! in_array( $this->query_vars['taxonomy'], $queryable_taxonomies ) ) {
     298                                unset( $this->query_vars['taxonomy'], $this->query_vars['term'] );
     299                        }
     300                }
     301
    287302                // Limit publicly queried post_types to those that are publicly_queryable
    288303                if ( isset( $this->query_vars['post_type']) ) {
    289304                        $queryable_post_types = get_post_types( array('publicly_queryable' => true) );