Make WordPress Core


Ignore:
Timestamp:
08/23/2020 12:06:04 AM (4 years ago)
Author:
SergeyBiryukov
Message:

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

Follow-up to [48840].

See #36399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r48840 r48843  
    11711171 *
    11721172 * @param array|string $args       Optional. Array or string of arguments. See WP_Term_Query::__construct()
    1173  *                                 for information on accepted arguments. Default empty.
    1174  * @param array|string $deprecated Argument array, when using the legacy function parameter format. If present,
    1175  *                                 this parameter will be interpreted as `$args`, and the first function parameter
    1176  *                                 will be parsed as a taxonomy or array of taxonomies.
     1173 *                                 for information on accepted arguments. Default empty array.
     1174 * @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
     1175 *                                 If present, this parameter will be interpreted as `$args`, and the first
     1176 *                                 function parameter will be parsed as a taxonomy or array of taxonomies.
     1177 *                                 Default empty.
    11771178 * @return WP_Term[]|int|WP_Error Array of WP_Term instances, a count thereof,
    11781179 *                                or WP_Error if any of the taxonomies do not exist.
     
    17331734 * @since 5.6.0 Changed the function signature so that the `$args` array can be provided as the first parameter.
    17341735 *
     1736 * @internal The `$deprecated` parameter is parsed for backward compatibility only.
     1737 *
    17351738 * @param array|string $args       Optional. Array of arguments that get passed to get_terms().
    17361739 *                                 Default empty array.
    1737  * @param array|string $deprecated Taxonomy name.
     1740 * @param array|string $deprecated Optional. Argument array, when using the legacy function parameter format.
     1741 *                                 If present, this parameter will be interpreted as `$args`, and the first
     1742 *                                 function parameter will be parsed as a taxonomy or array of taxonomies.
     1743 *                                 Default empty.
    17381744 * @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.
    17391745 */
    1740 function wp_count_terms( $args = array(), $deprecated = array() ) {
    1741     // Check whether function is used with legacy signature `$taxonomy` and `$args`.
    1742     $use_legacy_args = $args && ( is_string( $args ) && taxonomy_exists( $args ) || is_array( $args ) && wp_is_numeric_array( $args ) );
     1746function wp_count_terms( $args = array(), $deprecated = '' ) {
     1747    $use_legacy_args = false;
     1748
     1749    // Check whether function is used with legacy signature: `$taxonomy` and `$args`.
     1750    if ( $args
     1751        && ( is_string( $args ) && taxonomy_exists( $args )
     1752            || is_array( $args ) && wp_is_numeric_array( $args ) )
     1753    ) {
     1754        $use_legacy_args = true;
     1755    }
    17431756
    17441757    $defaults = array( 'hide_empty' => false );
     1758
    17451759    if ( $use_legacy_args ) {
    17461760        $defaults['taxonomy'] = $args;
Note: See TracChangeset for help on using the changeset viewer.