Make WordPress Core

Changeset 16381


Ignore:
Timestamp:
11/15/2010 10:51:39 AM (14 years ago)
Author:
scribu
Message:

Set 'taxonomy' and 'term' query vars for back-compat. Fixes #12659

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r16365 r16381  
    550550    // If there's a taxonomy
    551551    if ( is_tax() ) {
    552         $tax = get_taxonomy( get_query_var('taxonomy') );
     552        $term = get_queried_object();
     553        $tax = get_taxonomy( $term->taxonomy );
    553554        $title = single_term_title( $tax->labels->name . $t_sep, false );
    554555    }
  • trunk/wp-includes/query.php

    r16380 r16381  
    19441944
    19451945            // Back-compat
    1946             $cat_query = wp_list_filter( $q['tax_query'], array( 'taxonomy' => 'category', 'operator' => 'IN' ) );
    1947             if ( !empty( $cat_query ) ) {
    1948                 $cat_query = reset( $cat_query );
    1949                 $cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
    1950                 if ( $cat ) {
    1951                     $this->set( 'cat', $cat->term_id );
    1952                     $this->set( 'category_name', $cat->slug );
     1946            $tax_query_in = wp_list_filter( $q['tax_query'], array( 'operator' => 'IN' ) );
     1947            if ( !empty( $tax_query_in ) ) {
     1948                if ( !isset( $q['taxonomy'] ) ) {
     1949                    foreach ( $tax_query_in as $a_tax_query ) {
     1950                        if ( !in_array( $a_tax_query['taxonomy'], array( 'category', 'post_tag' ) ) ) {
     1951                            $q['taxonomy'] = $a_tax_query['taxonomy'];
     1952                            if ( 'slug' == $a_tax_query['field'] )
     1953                                $q['term'] = $a_tax_query['terms'][0];
     1954                            else
     1955                                $q['term_id'] = $a_tax_query['terms'][0];
     1956
     1957                            break;
     1958                        }
     1959                    }
     1960                }
     1961
     1962                $cat_query = wp_list_filter( $tax_query_in, array( 'taxonomy' => 'category' ) );
     1963                if ( !empty( $cat_query ) ) {
     1964                    $cat_query = reset( $cat_query );
     1965                    $cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
     1966                    if ( $cat ) {
     1967                        $this->set( 'cat', $cat->term_id );
     1968                        $this->set( 'category_name', $cat->slug );
     1969                    }
    19531970                }
    19541971            }
Note: See TracChangeset for help on using the changeset viewer.