mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
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
This commit is contained in:
parent
54f0cd204f
commit
025073bf5c
@ -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…
x
Reference in New Issue
Block a user