diff --git wp-includes/taxonomy-functions.php wp-includes/taxonomy-functions.php
index a13424b..466e3f8 100644
|
|
function get_terms( $taxonomies, $args = '' ) { |
1072 | 1072 | 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'description__like' => '', |
1073 | 1073 | 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core', |
1074 | 1074 | 'update_term_meta_cache' => true, 'meta_query' => '' ); |
| 1075 | |
| 1076 | // Keep a pristine copy of `$args` to pass to filters. |
| 1077 | $_args = $args; |
| 1078 | |
1075 | 1079 | $args = wp_parse_args( $args, $defaults ); |
1076 | 1080 | $args['number'] = absint( $args['number'] ); |
1077 | 1081 | $args['offset'] = absint( $args['offset'] ); |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1106 | 1110 | * Filter the terms query arguments. |
1107 | 1111 | * |
1108 | 1112 | * @since 3.1.0 |
| 1113 | * @since 4.4.0 Added the `$_args` parameter |
1109 | 1114 | * |
1110 | 1115 | * @param array $args An array of get_term() arguments. |
1111 | 1116 | * @param array $taxonomies An array of taxonomies. |
| 1117 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1112 | 1118 | */ |
1113 | | $args = apply_filters( 'get_terms_args', $args, $taxonomies ); |
| 1119 | $args = apply_filters( 'get_terms_args', $args, $taxonomies, $_args ); |
1114 | 1120 | |
1115 | 1121 | // Avoid the query if the queried parent/child_of term has no descendants. |
1116 | 1122 | $child_of = $args['child_of']; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1155 | 1161 | * Filter the given taxonomy's terms cache. |
1156 | 1162 | * |
1157 | 1163 | * @since 2.3.0 |
| 1164 | * @since 4.4.0 Added the `$_args` parameter |
1158 | 1165 | * |
1159 | 1166 | * @param array $cache Cached array of terms for the given taxonomy. |
1160 | 1167 | * @param array $taxonomies An array of taxonomies. |
1161 | 1168 | * @param array $args An array of get_terms() arguments. |
| 1169 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1162 | 1170 | */ |
1163 | | return apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1171 | return apply_filters( 'get_terms', $cache, $taxonomies, $args, $_args ); |
1164 | 1172 | } |
1165 | 1173 | |
1166 | 1174 | $_orderby = strtolower( $args['orderby'] ); |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1189 | 1197 | * Filter the ORDERBY clause of the terms query. |
1190 | 1198 | * |
1191 | 1199 | * @since 2.8.0 |
| 1200 | * @since 4.4.0 Added the `$_args` parameter |
1192 | 1201 | * |
1193 | 1202 | * @param string $orderby `ORDERBY` clause of the terms query. |
1194 | 1203 | * @param array $args An array of terms query arguments. |
1195 | 1204 | * @param array $taxonomies An array of taxonomies. |
| 1205 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1196 | 1206 | */ |
1197 | | $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies ); |
| 1207 | $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies, $_args ); |
1198 | 1208 | |
1199 | 1209 | $order = strtoupper( $args['order'] ); |
1200 | 1210 | if ( ! empty( $orderby ) ) { |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1261 | 1271 | * Filter the terms to exclude from the terms query. |
1262 | 1272 | * |
1263 | 1273 | * @since 2.3.0 |
| 1274 | * @since 4.4.0 Added the `$_args` parameter |
1264 | 1275 | * |
1265 | 1276 | * @param string $exclusions `NOT IN` clause of the terms query. |
1266 | 1277 | * @param array $args An array of terms query arguments. |
1267 | 1278 | * @param array $taxonomies An array of taxonomies. |
| 1279 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1268 | 1280 | */ |
1269 | | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies ); |
| 1281 | $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies, $_args ); |
1270 | 1282 | |
1271 | 1283 | if ( ! empty( $exclusions ) ) { |
1272 | 1284 | $where .= $exclusions; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1379 | 1391 | * Use of this filter can result in unpredictable behavior, and is not recommended. |
1380 | 1392 | * |
1381 | 1393 | * @since 2.8.0 |
| 1394 | * @since 4.4.0 Added the `$_args` parameter |
1382 | 1395 | * |
1383 | 1396 | * @param array $selects An array of fields to select for the terms query. |
1384 | 1397 | * @param array $args An array of term query arguments. |
1385 | 1398 | * @param array $taxonomies An array of taxonomies. |
| 1399 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1386 | 1400 | */ |
1387 | | $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) ); |
| 1401 | $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies, $_args ) ); |
1388 | 1402 | |
1389 | 1403 | $join .= " INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id"; |
1390 | 1404 | |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1394 | 1408 | * Filter the terms query SQL clauses. |
1395 | 1409 | * |
1396 | 1410 | * @since 3.1.0 |
| 1411 | * @since Added the `$_args` parameter |
1397 | 1412 | * |
1398 | 1413 | * @param array $pieces Terms query SQL clauses. |
1399 | 1414 | * @param array $taxonomies An array of taxonomies. |
1400 | 1415 | * @param array $args An array of terms query arguments. |
| 1416 | * @param array $_args Array of `get_terms()` arguments, as passed to the function. |
1401 | 1417 | */ |
1402 | | $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args ); |
| 1418 | $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args, $_args ); |
1403 | 1419 | |
1404 | 1420 | $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : ''; |
1405 | 1421 | $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : ''; |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1429 | 1445 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
1430 | 1446 | |
1431 | 1447 | /** This filter is documented in wp-includes/taxonomy-functions.php */ |
1432 | | return apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1448 | return apply_filters( 'get_terms', array(), $taxonomies, $args, $_args ); |
1433 | 1449 | } |
1434 | 1450 | |
1435 | 1451 | if ( $child_of ) { |
… |
… |
function get_terms( $taxonomies, $args = '' ) { |
1501 | 1517 | |
1502 | 1518 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
1503 | 1519 | |
1504 | | /** This filter is documented in wp-includes/taxonomy */ |
1505 | | return apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 1520 | /** This filter is documented in wp-includes/taxonomy-functions.php */ |
| 1521 | return apply_filters( 'get_terms', $terms, $taxonomies, $args, $_args ); |
1506 | 1522 | } |
1507 | 1523 | |
1508 | 1524 | /** |