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

See #31118.
Built from https://develop.svn.wordpress.org/trunk@31284


git-svn-id: http://core.svn.wordpress.org/trunk@31265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-01-26 18:09:22 +00:00
parent cfba917080
commit af6e0f5c55
2 changed files with 12 additions and 3 deletions

View File

@ -1629,7 +1629,14 @@ function get_terms( $taxonomies, $args = '' ) {
$args['offset'] = absint( $args['offset'] );
// Save queries by not crawling the tree in the case of multiple taxes or a flat tax.
if ( ! $single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) ) {
$has_hierarchical_tax = false;
foreach ( $taxonomies as $_tax ) {
if ( is_taxonomy_hierarchical( $_tax ) ) {
$has_hierarchical_tax = true;
}
}
if ( ! $has_hierarchical_tax ) {
$args['hierarchical'] = false;
$args['pad_counts'] = false;
}
@ -1963,7 +1970,9 @@ function get_terms( $taxonomies, $args = '' ) {
// Update term counts to include children.
if ( $args['pad_counts'] && 'all' == $_fields ) {
_pad_term_counts( $terms, reset( $taxonomies ) );
foreach ( $taxonomies as $_tax ) {
_pad_term_counts( $terms, $_tax );
}
}
// Make sure we show empty categories that have children.
if ( $hierarchical && $args['hide_empty'] && is_array( $terms ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31283';
$wp_version = '4.2-alpha-31284';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.