mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
cat_is_ancestor_of(). fixes #3387
git-svn-id: https://develop.svn.wordpress.org/trunk@4525 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -225,6 +225,21 @@ function get_cat_name($cat_id) {
|
||||
return $category->cat_name;
|
||||
}
|
||||
|
||||
function cat_is_ancestor_of($cat1, $cat2) {
|
||||
if ( is_int($cat1) )
|
||||
$cat1 = & get_category($cat1);
|
||||
if ( is_int($cat2) )
|
||||
$cat2 = & get_category($cat2);
|
||||
|
||||
if ( !$cat1->cat_ID || !$cat2->category_parent )
|
||||
return false;
|
||||
|
||||
if ( $cat2->category_parent == $cat1->cat_ID )
|
||||
return true;
|
||||
|
||||
return cat_is_ancestor_of($cat1, get_category($cat2->parent_category));
|
||||
}
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user