Changeset 4525
- Timestamp:
- 11/24/06 16:37:44 (2 years ago)
- Files:
-
- trunk/wp-admin/admin-db.php (modified) (1 diff)
- trunk/wp-includes/category.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-db.php
r4524 r4525 109 109 110 110 $category_parent = (int) $category_parent; 111 if ( empty($category_parent) || !get_category( $category_parent ) || $category_parent == $cat_ID)111 if ( empty($category_parent) || !get_category( $category_parent ) || ($cat_ID && _cat_is_ancestor_of($cat_ID, $category_parent) ) ) 112 112 $category_parent = 0; 113 113 trunk/wp-includes/category.php
r4519 r4525 226 226 } 227 227 228 function cat_is_ancestor_of($cat1, $cat2) { 229 if ( is_int($cat1) ) 230 $cat1 = & get_category($cat1); 231 if ( is_int($cat2) ) 232 $cat2 = & get_category($cat2); 233 234 if ( !$cat1->cat_ID || !$cat2->category_parent ) 235 return false; 236 237 if ( $cat2->category_parent == $cat1->cat_ID ) 238 return true; 239 240 return cat_is_ancestor_of($cat1, get_category($cat2->parent_category)); 241 } 242 228 243 // 229 244 // Private
