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
1 changed files with 8 additions and 1 deletions

View File

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