From 025073bf5cc68284e4ef310a845f98868b8c841a Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Mon, 25 Feb 2008 22:18:41 +0000 Subject: [PATCH] Support category names in in_category(). Fixes #4558 props robmil. git-svn-id: https://develop.svn.wordpress.org/trunk@7030 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/category-template.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 9537ceb7d5..ba47b677f6 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -170,6 +170,10 @@ 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 ( !is_numeric($category) ) { + $category = get_cat_ID($category); + } + $categories = get_object_term_cache($post->ID, 'category'); if ( false === $categories ) $categories = wp_get_object_terms($post->ID, 'category');