Make WordPress Core

Changeset 5622


Ignore:
Timestamp:
06/01/2007 02:24:07 AM (17 years ago)
Author:
ryan
Message:

query by parent, not child_of, in get_nested_categories(). see #4189

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r5612 r5622  
    101101    }
    102102
    103     $cats = get_categories("child_of=$parent&hide_empty=0&fields=ids");
     103    $cats = get_categories("parent=$parent&hide_empty=0&fields=ids");
    104104
    105105    $result = array ();
  • trunk/wp-includes/taxonomy.php

    r5616 r5622  
    481481    $args = wp_parse_args( $args, $defaults );
    482482    $args['number'] = (int) $args['number'];
    483     if ( ! $single_taxonomy ) {
     483    if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
     484        '' != $args['parent'] ) {
    484485        $args['child_of'] = 0;
    485486        $args['hierarchical'] = false;
    486     } else if ( !is_taxonomy_hierarchical($taxonomies[0]) ) {
    487         $args['child_of'] = 0;
    488         $args['hierarchical'] = false;
    489     }
     487    }
     488
    490489    if ( 'all' == $args['get'] ) {
    491490        $args['child_of'] = 0;
     
    498497        $hierarchy = _get_term_hierarchy($taxonomies[0]);
    499498        if ( !isset($hierarchy[$child_of]) )
     499            return array();
     500    }
     501
     502    if ( $parent ) {
     503        $hierarchy = _get_term_hierarchy($taxonomies[0]);
     504        if ( !isset($hierarchy[$parent]) )
    500505            return array();
    501506    }
     
    556561    }
    557562
    558     if ( !empty($parent) ) {
     563    if ( '' != $parent ) {
    559564        $parent = (int) $parent;
    560565        $where = " AND tt.parent = '$parent'";
Note: See TracChangeset for help on using the changeset viewer.