WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/29/2007 09:27:49 PM (15 years ago)
Author:
ryan
Message:

get_term_children() and category query fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r5592 r5593  
    657657}
    658658
     659function get_term_children( $term, $taxonomy ) {
     660    $terms = _get_term_hierarchy($taxonomy);
     661
     662    if ( ! isset($terms[$term]) )
     663        return array();
     664
     665    $children = $terms[$term];
     666
     667    foreach ( $terms[$term] as $child ) {
     668        if ( isset($terms[$child]) )
     669            $children = array_merge($children, get_term_children($child, $taxonomy));
     670    }
     671
     672    return $children;
     673}
     674
    659675function clean_term_cache($ids, $taxonomy) {
    660676    if ( !is_array($ids) )
Note: See TracChangeset for help on using the changeset viewer.