WordPress.org

Make WordPress Core

Ticket #34175: 34175.get_terms_fields_terms.2.taxonomy-functions.php.patch

File 34175.get_terms_fields_terms.2.taxonomy-functions.php.patch, 1.4 KB (added by wpsmith, 4 years ago)

It should be noted that if considered, then get_terms_fields_terms will need documentation.

  • wp-includes/taxonomy-functions.php

     
    13731373         * parameter alone.
    13741374         *
    13751375         * Use of this filter can result in unpredictable behavior, and is not recommended.
     1376         * If using this filter, you should also consider using 'get_terms_fields_terms' to
     1377         * arrange the output accordingly.
    13761378         *
    13771379         * @since 2.8.0
    13781380         *
     
    14851487                foreach ( $terms as $term ) {
    14861488                        $_terms[ $term->term_id ] = $term->slug;
    14871489                }
     1490        } else {
     1491
     1492                /**
     1493                 * Filter the terms to arrange the return accordingly.
     1494                 *
     1495                 * Field lists modified using this filter will only modify the term fields returned
     1496                 * by the function when the `$fields` parameter set to a custom value different from
     1497                 * default values.
     1498                 *
     1499                 * Use of this filter can result in unpredictable behavior, and is not recommended.
     1500                 *
     1501                 * @since 4.4.0
     1502                 *
     1503                 * @param array $_terms     An array of terms to return.
     1504                 * @param array $_fields    Current fields parameter.
     1505                 * @param array $args       An array of term query arguments.
     1506                 * @param array $taxonomies An array of taxonomies.
     1507                 */
     1508                $_terms = apply_filters( 'get_terms_fields_terms', $_terms, $_fields, $args, $taxonomies );
    14881509        }
    14891510
    14901511        if ( ! empty( $_terms ) ) {