terms_clauses WordPress Filter Hook
The terms_clauses hook is used to modify the terms query clauses used by WordPress. It takes two arguments: $pieces, which is an array containing the pieces of the terms query, and $taxonomies, an array of taxonomies being queried. This hook can be used to modify the ORDER BY, GROUP BY, and LIMIT clauses of the terms query. For example, you could use this hook to alphabetize terms by name, or to display terms in ascending or descending order by ID.
apply_filters( 'terms_clauses', string[] $clauses , string[] $taxonomies , array $args ) #
Filters the terms query SQL clauses.
Parameters
- $clauses
(string[])Associative array of the clauses for the query.
- 'fields'
(string) The SELECT clause of the query. - 'join'
(string) The JOIN clause of the query. - 'where'
(string) The WHERE clause of the query. - 'distinct'
(string) The DISTINCT clause of the query. - 'orderby'
(string) The ORDER BY clause of the query. - 'order'
(string) The ORDER clause of the query. - 'limits'
(string) The LIMIT clause of the query.
- 'fields'
- $taxonomies
(string[])An array of taxonomy names.
- $args
(array)An array of term query arguments.
Source
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |