terms_clauses
云策文档标注
概述
terms_clauses 是一个 WordPress 过滤器,用于修改术语查询的 SQL 子句。它允许开发者在执行 WP_Term_Query 时自定义查询结构。
关键要点
- 过滤器名称:terms_clauses
- 参数:$clauses(关联数组,包含查询子句如 SELECT、JOIN、WHERE 等)、$taxonomies(分类法名称数组)、$args(查询参数数组)
- 用途:通过 apply_filters 调用,在 WP_Term_Query::get_terms() 中应用,用于调整术语查询的 SQL 语句
- 引入版本:WordPress 3.1.0
原文内容
Filters the terms query SQL clauses.
Parameters
$clausesstring[]-
Associative array of the clauses for the query.
fieldsstringThe SELECT clause of the query.joinstringThe JOIN clause of the query.wherestringThe WHERE clause of the query.distinctstringThe DISTINCT clause of the query.orderbystringThe ORDER BY clause of the query.orderstringThe ORDER clause of the query.limitsstringThe LIMIT clause of the query.
$taxonomiesstring[]-
An array of taxonomy names.
$argsarray-
An array of term query arguments.
Source
$clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |