Changeset 12729
- Timestamp:
- 01/15/2010 05:40:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r12711 r12729 798 798 if ( 'all' == $fields ) 799 799 $selects = array('t.*', 'tt.*'); 800 else if ( 'ids' == $fields )800 else if ( 'ids' == $fields || 'id=>parent' == $fields ) 801 801 $selects = array('t.term_id', 'tt.parent', 'tt.count'); 802 802 else if ( 'names' == $fields ) 803 803 $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name'); 804 804 $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args )); 805 805 806 806 $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit"; … … 845 845 846 846 $_terms = array(); 847 if ( 'ids' == $fields ) { 847 if ( 'id=>parent' == $fields ) { 848 while ( $term = array_shift($terms) ) 849 $_terms[$term->term_id] = $term->parent; 850 $terms = $_terms; 851 } elseif ( 'ids' == $fields ) { 848 852 while ( $term = array_shift($terms) ) 849 853 $_terms[] = $term->term_id; … … 2067 2071 2068 2072 $children = array(); 2069 $terms = get_terms($taxonomy, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id s'));2070 foreach ( $terms as $term ) {2071 if ( $ term->parent > 0 )2072 $children[$ term->parent][] = $term->term_id;2073 $terms = get_terms($taxonomy, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent')); 2074 foreach ( $terms as $term_id => $parent ) { 2075 if ( $parent > 0 ) 2076 $children[$parent][] = $term_id; 2073 2077 } 2074 2078 set_transient("{$taxonomy}_children", $children);
Note: See TracChangeset
for help on using the changeset viewer.