diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 0d866faac..4da97f13f 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -140,6 +140,10 @@ class WP { $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars); + foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) + if ( isset($t->query_var) ) + $taxonomy_query_vars[$t->query_var] = $taxonomy; + for ($i=0; $ipublic_query_vars); $i += 1) { $wpvar = $this->public_query_vars[$i]; if (isset($this->extra_query_vars[$wpvar])) @@ -153,8 +157,13 @@ class WP { elseif (!empty($perma_query_vars[$wpvar])) $this->query_vars[$wpvar] = $perma_query_vars[$wpvar]; - if ( !empty( $this->query_vars[$wpvar] ) ) + if ( !empty( $this->query_vars[$wpvar] ) ) { $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; + if ( in_array( $wpvar, $taxonomy_query_vars ) ) { + $this->query_vars['taxonomy'] = $taxonomy_query_vars[$wpvar]; + $this->query_vars['term'] = $this->query_vars[$wpvar]; + } + } } foreach ($this->private_query_vars as $var) { diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 4955f07db..7ff488fca 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -159,7 +159,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) { $args = wp_parse_args($args, $defaults); if ( false !== $args['query_var'] && !empty($wp) ) { - if ( empty($args['query_var']) ) + if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy; $args['query_var'] = sanitize_title_with_dashes($args['query_var']); $wp->add_query_var($args['query_var']);