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
This commit is contained in:
parent
fcec1e31d2
commit
fdb26f5bae
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue