WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/08/2021 03:22:17 PM (3 months ago)
Author:
johnbillion
Message:

Taxonomy: Correct and clarify documentation for the return types of term query functions.

See #51800, #38266

File:
1 edited

Legend:

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

    r49935 r49947  
    11321132
    11331133/**
    1134  * Retrieve the terms in a given taxonomy or list of taxonomies.
     1134 * Retrieves the terms in a given taxonomy or list of taxonomies.
    11351135 *
    11361136 * You can fully inject any customizations to the query before it is sent, as
    11371137 * well as control the output with a filter.
     1138 *
     1139 * The return type varies depending on the value passed to `$args['fields']`. See
     1140 * WP_Term_Query::get_terms() for details. In all cases, a `WP_Error` object will
     1141 * be returned if an invalid taxonomy is requested.
    11381142 *
    11391143 * The {@see 'get_terms'} filter will be called when the cache has the term and will
     
    11781182 *                                 function parameter will be parsed as a taxonomy or array of taxonomies.
    11791183 *                                 Default empty.
    1180  * @return WP_Term[]|int|WP_Error Array of WP_Term instances, a count thereof,
    1181  *                                or WP_Error if any of the taxonomies do not exist.
     1184 * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string,
     1185 *                                                  or WP_Error if any of the taxonomies do not exist.
     1186 *                                                  See the function description for more information.
    11821187 */
    11831188function get_terms( $args = array(), $deprecated = '' ) {
     
    17461751 *                                 function parameter will be parsed as a taxonomy or array of taxonomies.
    17471752 *                                 Default empty.
    1748  * @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.
     1753 * @return string|WP_Error Numeric string containing the number of terms in that
     1754 *                         taxonomy or WP_Error if the taxonomy does not exist.
    17491755 */
    17501756function wp_count_terms( $args = array(), $deprecated = '' ) {
Note: See TracChangeset for help on using the changeset viewer.