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;