Fix default taxonomy query var. Populate taxonomy and term query vars ASAP. Fixes template fall-through. Hat tip: andy

git-svn-id: http://svn.automattic.com/wordpress/trunk@7940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-05-16 02:35:24 +00:00
parent 691eccf400
commit 7b0c0703f5
2 changed files with 11 additions and 2 deletions

View File

@ -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; $i<count($this->public_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) {

View File

@ -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']);