terms_clauses filter-hookWP 3.1.0

Filters the terms query SQL clauses.

Usage

add_filter( 'terms_clauses', 'wp_kama_terms_clauses_filter', 10, 3 );

/**
 * Function for `terms_clauses` filter-hook.
 * 
 * @param string[] $clauses    Associative array of the clauses for the query.
 * @param string[] $taxonomies An array of taxonomy names.
 * @param array    $args       An array of term query arguments.
 *
 * @return string[]
 */
function wp_kama_terms_clauses_filter( $clauses, $taxonomies, $args ){

	// filter...
	return $clauses;
}
$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.

Changelog

Since 3.1.0 Introduced.

Where the hook is called

WP_Term_Query::get_terms()
terms_clauses
wp-includes/class-wp-term-query.php 731
$clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );

Where the hook is used in WordPress

Usage not found.