Don't cache filtered term objects. see #8146

git-svn-id: http://svn.automattic.com/wordpress/trunk@9737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-11-17 20:03:31 +00:00
parent 2cd30ad069
commit 1039d131fe

View File

@ -309,10 +309,12 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
return $error;
}
if ( is_object($term) ) {
if ( is_object($term) && empty($term->filter) ) {
wp_cache_add($term->term_id, $term, $taxonomy);
$_term = $term;
} else {
if ( is_object($term) )
$term = $term->term_id;
$term = (int) $term;
if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
$_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) );
@ -890,6 +892,11 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
}
}
if ( $do_object )
$term->filter = $context;
else
$term['filter'] = $context;
return $term;
}