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.

$taxonomies

(string[])An array of taxonomy names.

$args

(array)An array of term query arguments.


Top ↑

Source

File: wp-includes/class-wp-term-query.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.