From f9f1f16dca3e0be2d2db35920bec13e39fa3bb00 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 24 Mar 2008 20:39:05 +0000 Subject: [PATCH] in_category(): Return immediately if category is empty. git-svn-id: http://svn.automattic.com/wordpress/trunk@7505 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 ba3f18fe7..cceac1aef 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -182,14 +182,17 @@ function get_the_category_list($separator = '', $parents='', $post_id = false) { function in_category( $category ) { // Check if the current post is in the given category global $post; + if ( empty($category) ) + return false; + $cat_ID = get_cat_ID($category); - if (0 != $cat_ID) + if ( $cat_ID ) $category = $cat_ID; $categories = get_object_term_cache($post->ID, 'category'); if ( false === $categories ) $categories = wp_get_object_terms($post->ID, 'category'); - if(array_key_exists($category, $categories)) + if ( array_key_exists($category, $categories) ) return true; else return false;