Docs: Update the description for the $legacy parameter of wp_count_terms() for consistency with get_terms().

Follow-up to [48840].

See #36399.
Built from https://develop.svn.wordpress.org/trunk@48843


git-svn-id: http://core.svn.wordpress.org/trunk@48605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-08-23 00:08:06 +00:00
parent ee0943482f
commit 5fc75503e4
2 changed files with 23 additions and 9 deletions

View File

@ -1170,10 +1170,11 @@ function get_term_to_edit( $id, $taxonomy ) {
* @internal The `$deprecated` parameter is parsed for backward compatibility only.
*
* @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct()
* for information on accepted arguments. Default empty.
* @param array|string $deprecated Argument array, when using the legacy function parameter format. If present,
* this parameter will be interpreted as `$args`, and the first function parameter
* will be parsed as a taxonomy or array of taxonomies.
* for information on accepted arguments. Default empty array.
* @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
* If present, this parameter will be interpreted as `$args`, and the first
* function parameter will be parsed as a taxonomy or array of taxonomies.
* Default empty.
* @return WP_Term[]|int|WP_Error Array of WP_Term instances, a count thereof,
* or WP_Error if any of the taxonomies do not exist.
*/
@ -1732,16 +1733,29 @@ function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) {
* @since 2.3.0
* @since 5.6.0 Changed the function signature so that the `$args` array can be provided as the first parameter.
*
* @internal The `$deprecated` parameter is parsed for backward compatibility only.
*
* @param array|string $args Optional. Array of arguments that get passed to get_terms().
* Default empty array.
* @param array|string $deprecated Taxonomy name.
* @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
* If present, this parameter will be interpreted as `$args`, and the first
* function parameter will be parsed as a taxonomy or array of taxonomies.
* Default empty.
* @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.
*/
function wp_count_terms( $args = array(), $deprecated = array() ) {
// Check whether function is used with legacy signature `$taxonomy` and `$args`.
$use_legacy_args = $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) );
function wp_count_terms( $args = array(), $deprecated = '' ) {
$use_legacy_args = false;
// Check whether function is used with legacy signature: `$taxonomy` and `$args`.
if ( $args
&& ( is_string( $args ) && taxonomy_exists( $args )
|| is_array( $args ) && wp_is_numeric_array( $args ) )
) {
$use_legacy_args = true;
}
$defaults = array( 'hide_empty' => false );
if ( $use_legacy_args ) {
$defaults['taxonomy'] = $args;
$args = $deprecated;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-48842';
$wp_version = '5.6-alpha-48843';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.