Make WordPress Core


Ignore:
Timestamp:
08/21/2020 10:30:06 PM (4 years ago)
Author:
flixos90
Message:

Taxonomy: Allow for wp_count_terms( $args ) signature, making passing a taxonomy optional.

This brings wp_count_terms() in line with other taxonomy functions such as get_terms() which technically no longer require a taxonomy. Similar to the previously modified functions, no deprecation warning is triggered when using the legacy signature.

Fixes #36399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/import/import.php

    r47526 r48840  
    6666
    6767        // Check that terms were imported correctly.
    68         $this->assertEquals( 30, wp_count_terms( 'category' ) );
    69         $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
     68        $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     69        $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    7070        $foo = get_term_by( 'slug', 'foo', 'category' );
    7171        $this->assertEquals( 0, $foo->parent );
     
    231231        $this->assertEquals( 'author@example.org', $author->user_email );
    232232
    233         $this->assertEquals( 30, wp_count_terms( 'category' ) );
    234         $this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
     233        $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) );
     234        $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) );
    235235        $foo = get_term_by( 'slug', 'foo', 'category' );
    236236        $this->assertEquals( 0, $foo->parent );
Note: See TracChangeset for help on using the changeset viewer.