Make WordPress Core


Ignore:
Timestamp:
01/26/2015 06:08:59 PM (12 years ago)
Author:
boonebgorges
Message:

Ensure that 'pad_counts' is not discarded when the first of multiple taxonomies passed to get_terms() is non-hierarchical.

See #31118.

File:
1 edited

Legend:

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

    r31276 r31284  
    16301630
    16311631        // Save queries by not crawling the tree in the case of multiple taxes or a flat tax.
    1632         if ( ! $single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) ) {
     1632        $has_hierarchical_tax = false;
     1633        foreach ( $taxonomies as $_tax ) {
     1634                if ( is_taxonomy_hierarchical( $_tax ) ) {
     1635                        $has_hierarchical_tax = true;
     1636                }
     1637        }
     1638
     1639        if ( ! $has_hierarchical_tax ) {
    16331640                $args['hierarchical'] = false;
    16341641                $args['pad_counts'] = false;
     
    19641971        // Update term counts to include children.
    19651972        if ( $args['pad_counts'] && 'all' == $_fields ) {
    1966                 _pad_term_counts( $terms, reset( $taxonomies ) );
     1973                foreach ( $taxonomies as $_tax ) {
     1974                        _pad_term_counts( $terms, $_tax );
     1975                }
    19671976        }
    19681977        // Make sure we show empty categories that have children.
Note: See TracChangeset for help on using the changeset viewer.