Changeset 5612
- Timestamp:
- 05/31/2007 03:44:18 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r5608 r5612 86 86 87 87 function get_nested_categories( $default = 0, $parent = 0 ) { 88 global $post_ID, $mode, $wpdb; 89 90 if ( $post_ID ) { 91 $checked_categories = wp_get_post_categories($post_ID); 92 93 if ( count( $checked_categories ) == 0 ) { 94 // No selected categories, strange 88 global $post_ID, $mode, $wpdb, $checked_categories; 89 90 if ( empty($checked_categories) ) { 91 if ( $post_ID ) { 92 $checked_categories = wp_get_post_categories($post_ID); 93 94 if ( count( $checked_categories ) == 0 ) { 95 // No selected categories, strange 95 96 $checked_categories[] = $default; 96 } 97 } else { 98 $checked_categories[] = $default; 97 } 98 } else { 99 $checked_categories[] = $default; 100 } 99 101 } 100 102 101 103 $cats = get_categories("child_of=$parent&hide_empty=0&fields=ids"); 104 102 105 $result = array (); 103 104 106 if ( is_array( $cats ) ) { 105 107 foreach ( $cats as $cat) { 106 // TODO fix hierarchy 107 //$result[$cat]['children'] = get_nested_categories( $default, $cat); 108 $result[$cat]['children'] = get_nested_categories( $default, $cat); 108 109 $result[$cat]['cat_ID'] = $cat; 109 110 $result[$cat]['checked'] = in_array( $cat, $checked_categories ); -
trunk/wp-includes/taxonomy.php
r5598 r5612 408 408 function get_object_terms($object_ids, $taxonomies, $args = array()) { 409 409 global $wpdb; 410 410 error_log("Objects: " . var_export($object_ids, true), 0); 411 411 if ( !is_array($taxonomies) ) 412 412 $taxonomies = array($taxonomies); … … 483 483 extract($args); 484 484 485 if ( $child_of ) { 486 $hierarchy = _get_term_hierarchy($taxonomies[0]); 487 if ( !isset($hierarchy[$child_of]) ) 488 return array(); 489 } 490 485 491 $key = md5( serialize( $args ) . serialize( $taxonomies ) ); 486 492 if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.