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.

Built from https://develop.svn.wordpress.org/trunk@48840


git-svn-id: http://core.svn.wordpress.org/trunk@48602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Felix Arntz
2020-08-21 22:32:06 +00:00
parent 40ea11468b
commit 5918f7e11d
6 changed files with 24 additions and 14 deletions

View File

@@ -263,7 +263,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
unset( $count_args['number'], $count_args['offset'] );
$total_terms = wp_count_terms( $this->taxonomy, $count_args );
$total_terms = wp_count_terms( $count_args );
// wp_count_terms() can return a falsey value when the term has no children.
if ( ! $total_terms ) {