WordPress.org

Make WordPress Core

Ticket #34195: 34195.deprecate.get_terms_fields.taxonomy-functions.php.patch

File 34195.deprecate.get_terms_fields.taxonomy-functions.php.patch, 1.8 KB (added by wpsmith, 4 years ago)

deprecate notice for hook.

  • 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         *
     
    13801382         * @param array $args       An array of term query arguments.
    13811383         * @param array $taxonomies An array of taxonomies.
    13821384         */
     1385        if ( has_filter( 'get_terms_fields' ) ) {
     1386                _deprecated_function( 'get_terms_fields ' . __( 'hook' ), '4.4.0', 'get_terms ' . __( 'hook' ) )
     1387        }
    13831388        $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) );
    13841389
    13851390        $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
     
    14851490                foreach ( $terms as $term ) {
    14861491                        $_terms[ $term->term_id ] = $term->slug;
    14871492                }
     1493        } else {
     1494
     1495                /**
     1496                 * Filter the terms to arrange the return accordingly.
     1497                 *
     1498                 * Field lists modified using this filter will only modify the term fields returned
     1499                 * by the function when the `$fields` parameter set to a custom value different from
     1500                 * default values.
     1501                 *
     1502                 * Use of this filter can result in unpredictable behavior, and is not recommended.
     1503                 *
     1504                 * @since 4.4.0
     1505                 *
     1506                 * @param array $_terms     An array of terms to return.
     1507                 * @param string $_fields   Current fields parameter.
     1508                 * @param array $args       An array of term query arguments.
     1509                 * @param array $taxonomies An array of taxonomies.
     1510                 */
     1511                $_terms = apply_filters( 'get_terms_fields_terms', $_terms, $_fields, $args, $taxonomies );
    14881512        }
    14891513
    14901514        if ( ! empty( $_terms ) ) {