terms_clauses
Filter HookDescription
Filters the terms query SQL clauses. }Hook Information
File Location |
wp-includes/class-wp-term-query.php
View on GitHub
|
Hook Type | Filter |
Line Number | 731 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$clauses
|
{ Associative array of the clauses for the query. |
string[]
|
$taxonomies
|
An array of taxonomy names. |
array
|
$args
|
An array of term query arguments. |
Usage Examples
Basic Usage
<?php
// Hook into terms_clauses
add_filter('terms_clauses', 'my_custom_filter', 10, 3);
function my_custom_filter($clauses, $taxonomies, $args) {
// Your custom filtering logic here
return $clauses;
}
Source Code Context
wp-includes/class-wp-term-query.php:731
- How this hook is used in WordPress core
<?php
726 * @type string $limits The LIMIT clause of the query.
727 * }
728 * @param string[] $taxonomies An array of taxonomy names.
729 * @param array $args An array of term query arguments.
730 */
731 $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
732
733 $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
734 $join = isset( $clauses['join'] ) ? $clauses['join'] : '';
735 $where = isset( $clauses['where'] ) ? $clauses['where'] : '';
736 $distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';
PHP Documentation
<?php
/**
* Filters the terms query SQL clauses.
*
* @since 3.1.0
*
* @param string[] $clauses {
* Associative array of the clauses for the query.
*
* @type string $fields The SELECT clause of the query.
* @type string $join The JOIN clause of the query.
* @type string $where The WHERE clause of the query.
* @type string $distinct The DISTINCT clause of the query.
* @type string $orderby The ORDER BY clause of the query.
* @type string $order The ORDER clause of the query.
* @type string $limits The LIMIT clause of the query.
* }
* @param string[] $taxonomies An array of taxonomy names.
* @param array $args An array of term query arguments.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-term-query.php
Related Hooks
Related hooks will be displayed here in future updates.