WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/21/2020 10:30:06 PM (2 months 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/term/wpInsertTerm.php

    r47122 r48840  
    2525        $this->assertNull( term_exists( $term ) );
    2626
    27         $initial_count = wp_count_terms( $taxonomy );
     27        $initial_count = wp_count_terms( array( 'taxonomy' => $taxonomy ) );
    2828
    2929        $t = wp_insert_term( $term, $taxonomy );
     
    3232        $this->assertTrue( $t['term_id'] > 0 );
    3333        $this->assertTrue( $t['term_taxonomy_id'] > 0 );
    34         $this->assertEquals( $initial_count + 1, wp_count_terms( $taxonomy ) );
     34        $this->assertEquals( $initial_count + 1, wp_count_terms( array( 'taxonomy' => $taxonomy ) ) );
    3535
    3636        // Make sure the term exists.
     
    4444        $this->assertNull( term_exists( $term ) );
    4545        $this->assertNull( term_exists( $t['term_id'] ) );
    46         $this->assertEquals( $initial_count, wp_count_terms( $taxonomy ) );
     46        $this->assertEquals( $initial_count, wp_count_terms( array( 'taxonomy' => $taxonomy ) ) );
    4747    }
    4848
Note: See TracChangeset for help on using the changeset viewer.