diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index fe2bee4430..44d9dfb476 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -1238,7 +1238,7 @@ 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($taxonomies[0]) || + if ( !$single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) || '' !== $args['parent'] ) { $args['child_of'] = 0; $args['hierarchical'] = false; diff --git a/tests/phpunit/tests/term/getTerms.php b/tests/phpunit/tests/term/getTerms.php index 05f771f70c..eb576e659a 100644 --- a/tests/phpunit/tests/term/getTerms.php +++ b/tests/phpunit/tests/term/getTerms.php @@ -85,7 +85,7 @@ class Tests_Term_getTerms extends WP_UnitTestCase { function test_get_terms_should_allow_arbitrary_indexed_taxonomies_array() { $term_id = $this->factory->tag->create(); $terms = get_terms( array( '111' => 'post_tag' ), array( 'hide_empty' => false ) ); - $this->assertEquals( $term_id, $terms[0]->term_id ); + $this->assertEquals( $term_id, reset( $terms )->term_id ); } /**