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

git-svn-id: https://develop.svn.wordpress.org/trunk@15737 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu 2010-10-06 23:18:42 +00:00
parent 202ec80a4d
commit b6c2c3003c
1 changed files with 14 additions and 4 deletions

View File

@ -274,7 +274,13 @@ class WP {
$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
if ( !empty( $this->query_vars[$wpvar] ) ) {
$this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
if ( ! is_array( $this->query_vars[$wpvar] ) ) {
$this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
} else {
foreach ( $this->query_vars[$wpvar] as $vkey => $v )
$this->query_vars[$wpvar][$vkey] = (string) $v;
}
if ( isset( $taxonomy_query_vars[$wpvar] ) ) {
$this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar];
$this->query_vars['term'] = $this->query_vars[$wpvar];
@ -287,9 +293,13 @@ class WP {
// Limit publicly queried post_types to those that are publicly_queryable
if ( isset( $this->query_vars['post_type']) ) {
$queryable_post_types = get_post_types( array('publicly_queryable' => true) );
if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
unset( $this->query_vars['post_type'] );
$queryable_post_types = get_post_types( array('publicly_queryable' => true) );
if ( ! is_array( $this->query_vars['post_type'] ) ) {
if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
unset( $this->query_vars['post_type'] );
} else {
$this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
}
}
foreach ( (array) $this->private_query_vars as $var) {