Make WordPress Core

Ticket #33369: 33369.diff

File 33369.diff, 5.0 KB (added by boonebgorges, 9 years ago)
  • src/wp-includes/taxonomy.php

    diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
    index beb536b..bf83600 100644
    function get_terms( $taxonomies, $args = '' ) { 
    16791679                'number' => '', 'fields' => 'all', 'name' => '', 'slug' => '', 'parent' => '', 'childless' => false,
    16801680                'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'description__like' => '',
    16811681                'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' );
     1682
     1683        // Keep a pristine copy of `$args` to pass to filters.
     1684        $_args = $args;
     1685
    16821686        $args = wp_parse_args( $args, $defaults );
    16831687        $args['number'] = absint( $args['number'] );
    16841688        $args['offset'] = absint( $args['offset'] );
    function get_terms( $taxonomies, $args = '' ) { 
    17161720         *
    17171721         * @param array $args       An array of get_term() arguments.
    17181722         * @param array $taxonomies An array of taxonomies.
     1723         * @param array $_args      Array of `get_terms()` arguments, as passed to the function.
    17191724         */
    1720         $args = apply_filters( 'get_terms_args', $args, $taxonomies );
     1725        $args = apply_filters( 'get_terms_args', $args, $taxonomies, $_args );
    17211726
    17221727        // Avoid the query if the queried parent/child_of term has no descendants.
    17231728        $child_of = $args['child_of'];
    function get_terms( $taxonomies, $args = '' ) { 
    17661771                 * @param array $cache      Cached array of terms for the given taxonomy.
    17671772                 * @param array $taxonomies An array of taxonomies.
    17681773                 * @param array $args       An array of get_terms() arguments.
     1774                 * @param array $_args      Array of `get_terms()` arguments, as passed to the function.
    17691775                 */
    1770                 return apply_filters( 'get_terms', $cache, $taxonomies, $args );
     1776                return apply_filters( 'get_terms', $cache, $taxonomies, $args, $_args );
    17711777        }
    17721778
    17731779        $_orderby = strtolower( $args['orderby'] );
    function get_terms( $taxonomies, $args = '' ) { 
    18001806         * @param string $orderby    `ORDERBY` clause of the terms query.
    18011807         * @param array  $args       An array of terms query arguments.
    18021808         * @param array  $taxonomies An array of taxonomies.
     1809         * @param array  $_args      Array of `get_terms()` arguments, as passed to the function.
    18031810         */
    1804         $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies );
     1811        $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies, $_args );
    18051812
    18061813        $order = strtoupper( $args['order'] );
    18071814        if ( ! empty( $orderby ) ) {
    function get_terms( $taxonomies, $args = '' ) { 
    18721879         * @param string $exclusions `NOT IN` clause of the terms query.
    18731880         * @param array  $args       An array of terms query arguments.
    18741881         * @param array  $taxonomies An array of taxonomies.
     1882         * @param array  $_args      Array of `get_terms()` arguments, as passed to the function.
    18751883         */
    1876         $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies );
     1884        $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies, $_args );
    18771885
    18781886        if ( ! empty( $exclusions ) ) {
    18791887                $where .= $exclusions;
    function get_terms( $taxonomies, $args = '' ) { 
    19801988         * @param array $selects    An array of fields to select for the terms query.
    19811989         * @param array $args       An array of term query arguments.
    19821990         * @param array $taxonomies An array of taxonomies.
     1991         * @param array $_args      Array of `get_terms()` arguments, as passed to the function.
    19831992         */
    1984         $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) );
     1993        $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies, $_args ) );
    19851994
    19861995        $join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
    19871996
    function get_terms( $taxonomies, $args = '' ) { 
    19952004         * @param array $pieces     Terms query SQL clauses.
    19962005         * @param array $taxonomies An array of taxonomies.
    19972006         * @param array $args       An array of terms query arguments.
     2007         * @param array $_args      Array of `get_terms()` arguments, as passed to the function.
    19982008         */
    1999         $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
     2009        $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args, $_args );
    20002010
    20012011        $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
    20022012        $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
    function get_terms( $taxonomies, $args = '' ) { 
    20202030                wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
    20212031
    20222032                /** This filter is documented in wp-includes/taxonomy.php */
    2023                 return apply_filters( 'get_terms', array(), $taxonomies, $args );
     2033                return apply_filters( 'get_terms', array(), $taxonomies, $args, $_args );
    20242034        }
    20252035
    20262036        if ( $child_of ) {
    function get_terms( $taxonomies, $args = '' ) { 
    20932103        wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
    20942104
    20952105        /** This filter is documented in wp-includes/taxonomy */
    2096         return apply_filters( 'get_terms', $terms, $taxonomies, $args );
     2106        return apply_filters( 'get_terms', $terms, $taxonomies, $args, $_args );
    20972107}
    20982108
    20992109/**