From 5fc75503e459fd09c57c96a129a1b80f306ce89b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 23 Aug 2020 00:08:06 +0000 Subject: [PATCH] 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 --- wp-includes/taxonomy.php | 30 ++++++++++++++++++++++-------- wp-includes/version.php | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index c61964bdcf..da0744e674 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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; diff --git a/wp-includes/version.php b/wp-includes/version.php index f817e15b61..0ce62de769 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.