Make WordPress Core

Changeset 25108


Ignore:
Timestamp:
08/23/2013 09:28:34 PM (11 years ago)
Author:
wonderboymusic
Message:

Use reset() to grab the first taxonomy in an array, not by numerical index. Cleans up whitespace. Props webord, nbachiyski. Fixes #23506.

File:
1 edited

Legend:

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

    r25106 r25108  
    12361236
    12371237    if ( $child_of ) {
    1238         $hierarchy = _get_term_hierarchy($taxonomies[0]);
    1239         if ( !isset($hierarchy[$child_of]) )
     1238        $hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
     1239        if ( ! isset( $hierarchy[ $child_of ] ) )
    12401240            return $empty_array;
    12411241    }
    12421242
    12431243    if ( $parent ) {
    1244         $hierarchy = _get_term_hierarchy($taxonomies[0]);
    1245         if ( !isset($hierarchy[$parent]) )
     1244        $hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
     1245        if ( ! isset( $hierarchy[ $parent ] ) )
    12461246            return $empty_array;
    12471247    }
     
    13081308
    13091309    $exclusions = '';
    1310     if ( !empty( $exclude_tree ) ) {
    1311         $excluded_trunks = wp_parse_id_list($exclude_tree);
     1310    if ( ! empty( $exclude_tree ) ) {
     1311        $excluded_trunks = wp_parse_id_list( $exclude_tree );
    13121312        foreach ( $excluded_trunks as $extrunk ) {
    1313             $excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids', 'hide_empty' => 0));
     1313            $excluded_children = (array) get_terms( reset( $taxonomies ), array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) );
    13141314            $excluded_children[] = $extrunk;
    13151315            foreach( $excluded_children as $exterm ) {
    1316                 if ( empty($exclusions) )
     1316                if ( empty( $exclusions ) )
    13171317                    $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
    13181318                else
     
    14201420
    14211421    if ( $child_of ) {
    1422         $children = _get_term_hierarchy($taxonomies[0]);
    1423         if ( ! empty($children) )
    1424             $terms = _get_term_children($child_of, $terms, $taxonomies[0]);
     1422        $children = _get_term_hierarchy( reset( $taxonomies ) );
     1423        if ( ! empty( $children ) )
     1424            $terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) );
    14251425    }
    14261426
    14271427    // Update term counts to include children.
    14281428    if ( $pad_counts && 'all' == $fields )
    1429         _pad_term_counts($terms, $taxonomies[0]);
     1429        _pad_term_counts( $terms, reset( $taxonomies ) );
    14301430
    14311431    // Make sure we show empty categories that have children.
    1432     if ( $hierarchical && $hide_empty && is_array($terms) ) {
     1432    if ( $hierarchical && $hide_empty && is_array( $terms ) ) {
    14331433        foreach ( $terms as $k => $term ) {
    14341434            if ( ! $term->count ) {
    1435                 $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
    1436                 if ( is_array($children) )
     1435                $children = _get_term_children( $term->term_id, $terms, reset( $taxonomies ) );
     1436                if ( is_array( $children ) )
    14371437                    foreach ( $children as $child )
    14381438                        if ( $child->count )
Note: See TracChangeset for help on using the changeset viewer.