Changeset 5178
- Timestamp:
- 04/04/2007 08:44:45 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r5152 r5178 792 792 $categories = get_categories( 'hide_empty=0' ); 793 793 794 $children = _get_category_hierarchy(); 795 794 796 if ( $categories ) { 795 797 ob_start(); … … 797 799 if ( $category->category_parent == $parent) { 798 800 echo "\t" . _cat_row( $category, $level ); 799 cat_rows( $category->cat_ID, $level +1, $categories ); 801 if ( isset($children[$category->cat_ID]) ) 802 cat_rows( $category->cat_ID, $level +1, $categories ); 800 803 } 801 804 } -
trunk/wp-includes/category.php
r5149 r5178 110 110 } 111 111 112 if ( $child_of || $hierarchical ) 113 $categories = & _get_cat_children($child_of, $categories); 112 if ( $child_of || $hierarchical ) { 113 $children = _get_category_hierarchy(); 114 if ( ! empty($children) ) 115 $categories = & _get_cat_children($child_of, $categories); 116 } 114 117 115 118 // Update category counts to include children. … … 261 264 262 265 $category_list = array(); 266 $children = _get_category_hierarchy(); 263 267 foreach ( $categories as $category ) { 264 268 if ( $category->cat_ID == $category_id ) … … 267 271 if ( $category->category_parent == $category_id ) { 268 272 $category_list[] = $category; 273 if ( !isset($children[$category->cat_ID]) ) 274 continue; 275 269 276 if ( $children = _get_cat_children($category->cat_ID, $categories) ) 270 277 $category_list = array_merge($category_list, $children); … … 314 321 } 315 322 323 function _get_category_hierarchy() { 324 $children = get_option('category_children'); 325 if ( is_array($children) ) 326 return $children; 327 328 $children = array(); 329 $categories = get_categories('hide_empty=0&hierarchical=0'); 330 foreach ( $categories as $cat ) { 331 if ( $cat->category_parent > 0 ) 332 $children[$cat->category_parent][] = $cat->cat_ID; 333 } 334 update_option('category_children', $children); 335 336 return $children; 337 } 316 338 ?> -
trunk/wp-includes/functions.php
r5163 r5178 750 750 wp_cache_delete('all_category_ids', 'category'); 751 751 wp_cache_delete('get_categories', 'category'); 752 delete_option('category_children'); 752 753 } 753 754
Note: See TracChangeset
for help on using the changeset viewer.