WordPress.org

Make WordPress Core

Ticket #8146: 8146.diff

File 8146.diff, 894 bytes (added by ryan, 12 years ago)
  • wp-includes/taxonomy.php

     
    309309                return $error;
    310310        }
    311311
    312         if ( is_object($term) ) {
     312        if ( is_object($term) && empty($term->filter) ) {
    313313                wp_cache_add($term->term_id, $term, $taxonomy);
    314314                $_term = $term;
    315315        } else {
     316                if ( is_object($term) )
     317                        $term = $term->term_id;
    316318                $term = (int) $term;
    317319                if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
    318320                        $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
     
    890892                }
    891893        }
    892894
     895        if ( $do_object )
     896                $term->filter = $context;
     897        else
     898                $term['filter'] = $context;
     899
    893900        return $term;
    894901}
    895902