From 1039d131fedfb363e20a7c5c5e12edb9d26ae25f Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 17 Nov 2008 20:03:31 +0000 Subject: [PATCH] Don't cache filtered term objects. see #8146 git-svn-id: http://svn.automattic.com/wordpress/trunk@9737 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 7e6c11485..0166cd5b2 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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; }