Make WordPress Core

Changeset 15685


Ignore:
Timestamp:
10/02/2010 06:03:06 PM (14 years ago)
Author:
scribu
Message:

Set 'cat' query var for backwards compatibility. Fixes #15007

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r15680 r15685  
    30343034
    30353035    foreach ( $list as $key => $obj ) {
    3036         $matched = count(array_intersect_assoc(get_object_vars($obj), $args));
     3036        $matched = count( array_intersect_assoc( (array) ($obj), $args ) );
    30373037        if ( ('and' == $operator && $matched == $count) || ('or' == $operator && $matched <= $count) ) {
    30383038            if ( $field )
  • trunk/wp-includes/query.php

    r15672 r15685  
    19491949            else
    19501950                $where .= ' AND 0 = 1';
     1951
     1952            // Back-compat
     1953            if ( !empty( $ids ) ) {
     1954                $cat_query = wp_filter_object_list( $tax_query, array( 'taxonomy' => 'category' ) );
     1955                if ( !empty( $cat_query ) ) {
     1956                    $cat_query = reset( $cat_query );
     1957                    $cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
     1958                    if ( $cat ) {
     1959                        $this->set('cat', $cat->term_id);
     1960                        $this->set('category_name', $cat->slug);
     1961                    }
     1962                }
     1963            }
     1964
     1965            unset( $ids );
    19511966        }
    19521967
Note: See TracChangeset for help on using the changeset viewer.