From 2ae70d7c729d13b4955e85f5076f2d168c6e8ace Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 14 Aug 2007 03:01:26 +0000 Subject: [PATCH] Update in_category() to use object term cache API. Props technosailor. fixes #4442 git-svn-id: http://svn.automattic.com/wordpress/trunk@5868 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category-template.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 8833f05881..7e3950871f 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -156,9 +156,12 @@ function get_the_category_list($separator = '', $parents='') { } function in_category( $category ) { // Check if the current post is in the given category - global $object_term_cache, $post, $blog_id; + global $post, $blog_id; - if ( isset( $object_term_cache[$blog_id][$post->ID]['category'][$category] ) ) + $categories = get_object_term_cache($post->ID, 'category'); + if ( false === $categories ) + $categories = get_object_terms($post->ID, 'category'); + if(array_key_exists($category, $categories)) return true; else return false;