diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index cd36bec16f..d8abfc00fa 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1628,13 +1628,19 @@ function get_terms( $taxonomies, $args = '' ) { $args = wp_parse_args( $args, $defaults ); $args['number'] = absint( $args['number'] ); $args['offset'] = absint( $args['offset'] ); - if ( !$single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) || - ( '' !== $args['parent'] && 0 !== $args['parent'] ) ) { - $args['child_of'] = 0; + + // 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 ) ) ) { + $args['child_of'] = false; $args['hierarchical'] = false; $args['pad_counts'] = false; } + // 'parent' overrides 'child_of'. + if ( 0 < intval( $args['parent'] ) ) { + $args['child_of'] = false; + } + if ( 'all' == $args['get'] ) { $args['child_of'] = 0; $args['hide_empty'] = 0; diff --git a/wp-includes/version.php b/wp-includes/version.php index 8962afb2c1..5c54f7f5b0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-alpha-30106'; +$wp_version = '4.1-alpha-30107'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.