diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index f201b36c25..42bff05e36 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -3685,7 +3685,7 @@ function get_term_link( $term, $taxonomy = '') { * * @param array $args Override the defaults. */ -function the_taxonomies($args = array()) { +function the_taxonomies( $args = array() ) { $defaults = array( 'post' => 0, 'before' => '', @@ -3695,9 +3695,8 @@ function the_taxonomies($args = array()) { ); $r = wp_parse_args( $args, $defaults ); - extract( $r, EXTR_SKIP ); - echo $before . join($sep, get_the_taxonomies($post, $r)) . $after; + echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after']; } /** diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php index fbab63f2a4..979cca14b8 100644 --- a/tests/phpunit/tests/taxonomy.php +++ b/tests/phpunit/tests/taxonomy.php @@ -49,6 +49,18 @@ class Tests_Taxonomy extends WP_UnitTestCase { $this->assertEquals( array( 'category', 'post_tag' ), array_keys( $taxes ) ); } + function test_the_taxonomies() { + $post_id = $this->factory->post->create(); + + ob_start(); + the_taxonomies( array( 'post' => $post_id ) ); + $output = ob_get_clean(); + + $link = get_category_link( 1 ); + $expected = "Categories: Uncategorized."; + $this->assertEquals( $expected, $output ); + } + function test_get_link_taxonomy() { foreach ( get_object_taxonomies('link') as $taxonomy ) { $tax = get_taxonomy($taxonomy);