diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
index beb536b..bf83600 100644
|
|
function get_terms( $taxonomies, $args = '' ) { |
1679 | 1679 | 'number' => '', 'fields' => 'all', 'name' => '', 'slug' => '', 'parent' => '', 'childless' => false, |
1680 | 1680 | 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'description__like' => '', |
1681 | 1681 | 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' ); |
| 1682 | |
| 1683 | // Keep a pristine copy of `$args` to pass to filters. |
| 1684 | $_args = $args; |
| 1685 | |
1682 | 1686 | $args = wp_parse_args( $args, $defaults ); |
1683 | 1687 | $args['number'] = absint( $args['number'] ); |
1684 | 1688 | $args['offset'] = absint( $args['offset'] ); |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1716 | 1720 | * |
1717 | 1721 | * @param array $args An array of get_term() arguments. |
1718 | 1722 | * @param array $taxonomies An array of taxonomies. |
| 1723 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1719 | 1724 | */ |
1720 | | $args = apply_filters( 'get_terms_args', $args, $taxonomies ); |
| 1725 | $args = apply_filters( 'get_terms_args', $args, $taxonomies, $_args ); |
1721 | 1726 | |
1722 | 1727 | // Avoid the query if the queried parent/child_of term has no descendants. |
1723 | 1728 | $child_of = $args['child_of']; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1766 | 1771 | * @param array $cache Cached array of terms for the given taxonomy. |
1767 | 1772 | * @param array $taxonomies An array of taxonomies. |
1768 | 1773 | * @param array $args An array of get_terms() arguments. |
| 1774 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1769 | 1775 | */ |
1770 | | return apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1776 | return apply_filters( 'get_terms', $cache, $taxonomies, $args, $_args ); |
1771 | 1777 | } |
1772 | 1778 | |
1773 | 1779 | $_orderby = strtolower( $args['orderby'] ); |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1800 | 1806 | * @param string $orderby `ORDERBY` clause of the terms query. |
1801 | 1807 | * @param array $args An array of terms query arguments. |
1802 | 1808 | * @param array $taxonomies An array of taxonomies. |
| 1809 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1803 | 1810 | */ |
1804 | | $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies ); |
| 1811 | $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies, $_args ); |
1805 | 1812 | |
1806 | 1813 | $order = strtoupper( $args['order'] ); |
1807 | 1814 | if ( ! empty( $orderby ) ) { |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1872 | 1879 | * @param string $exclusions `NOT IN` clause of the terms query. |
1873 | 1880 | * @param array $args An array of terms query arguments. |
1874 | 1881 | * @param array $taxonomies An array of taxonomies. |
| 1882 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1875 | 1883 | */ |
1876 | | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies ); |
| 1884 | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies, $_args ); |
1877 | 1885 | |
1878 | 1886 | if ( ! empty( $exclusions ) ) { |
1879 | 1887 | $where .= $exclusions; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1980 | 1988 | * @param array $selects An array of fields to select for the terms query. |
1981 | 1989 | * @param array $args An array of term query arguments. |
1982 | 1990 | * @param array $taxonomies An array of taxonomies. |
| 1991 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1983 | 1992 | */ |
1984 | | $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) ); |
| 1993 | $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies, $_args ) ); |
1985 | 1994 | |
1986 | 1995 | $join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; |
1987 | 1996 | |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1995 | 2004 | * @param array $pieces Terms query SQL clauses. |
1996 | 2005 | * @param array $taxonomies An array of taxonomies. |
1997 | 2006 | * @param array $args An array of terms query arguments. |
| 2007 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1998 | 2008 | */ |
1999 | | $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args ); |
| 2009 | $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args, $_args ); |
2000 | 2010 | |
2001 | 2011 | $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
2002 | 2012 | $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
2020 | 2030 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
2021 | 2031 | |
2022 | 2032 | /** 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 ); |
2024 | 2034 | } |
2025 | 2035 | |
2026 | 2036 | if ( $child_of ) { |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
2093 | 2103 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
2094 | 2104 | |
2095 | 2105 | /** 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 ); |
2097 | 2107 | } |
2098 | 2108 | |
2099 | 2109 | /** |