diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-27 11:19:48 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-27 11:19:48 +0000 |
commit | 5447f131269541ea942ae9239c95b4e1188fb57c (patch) | |
tree | 11bbdce67a32ce816b14425dd95244786a29b801 /wp-includes/category.php | |
parent | 600b71019494e1c29898a620e58c0d2602f37b74 (diff) | |
download | wordpress-mu-5447f131269541ea942ae9239c95b4e1188fb57c.tar.gz wordpress-mu-5447f131269541ea942ae9239c95b4e1188fb57c.tar.xz wordpress-mu-5447f131269541ea942ae9239c95b4e1188fb57c.zip |
WP Merge to rev 4534
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@811 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/category.php')
-rw-r--r-- | wp-includes/category.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/wp-includes/category.php b/wp-includes/category.php index 7b3e7ca..690c196 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -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 // |