From fdb26f5baecfff73906bc9b926d354303f3e0c37 Mon Sep 17 00:00:00 2001 From: westi Date: Mon, 25 Feb 2008 22:18:41 +0000 Subject: [PATCH] Support category names in in_category(). Fixes #4558 props robmil. git-svn-id: http://svn.automattic.com/wordpress/trunk@7030 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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');