Make WordPress Core

Changeset 15737


Ignore:
Timestamp:
10/06/2010 11:18:42 PM (14 years ago)
Author:
scribu
Message:

Proper handling of array query variables. Props loushou. Fixes #14330

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r15734 r15737  
    275275
    276276            if ( !empty( $this->query_vars[$wpvar] ) ) {
    277                 $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
     277                if ( ! is_array( $this->query_vars[$wpvar] ) ) {
     278                    $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
     279                } else {
     280                    foreach ( $this->query_vars[$wpvar] as $vkey => $v )
     281                        $this->query_vars[$wpvar][$vkey] = (string) $v;
     282                }
     283
    278284                if ( isset( $taxonomy_query_vars[$wpvar] ) ) {
    279285                    $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
     
    288294        // Limit publicly queried post_types to those that are publicly_queryable
    289295        if ( isset( $this->query_vars['post_type']) ) {
    290             $queryable_post_types =  get_post_types( array('publicly_queryable' => true) );
    291             if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
    292                 unset( $this->query_vars['post_type'] );
     296            $queryable_post_types = get_post_types( array('publicly_queryable' => true) );
     297            if ( ! is_array( $this->query_vars['post_type'] ) ) {
     298                if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
     299                    unset( $this->query_vars['post_type'] );
     300            } else {
     301                $this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
     302            }
    293303        }
    294304
Note: See TracChangeset for help on using the changeset viewer.