posts_clauses_request
云策文档标注
概述
posts_clauses_request 是一个 WordPress 过滤器,用于一次性过滤查询的所有子句,方便缓存插件等使用。它覆盖 WHERE、GROUP BY、JOIN、ORDER BY、DISTINCT、fields (SELECT) 和 LIMIT 子句。
关键要点
- 过滤器名称:posts_clauses_request
- 主要用途:供缓存插件使用,一次性修改查询的多个子句
- 覆盖子句:WHERE、GROUP BY、JOIN、ORDER BY、DISTINCT、fields (SELECT)、LIMIT
- 参数:$clauses(关联数组,包含查询子句)和 $query(WP_Query 实例,引用传递)
- 引入版本:WordPress 3.1.0
- 相关函数:在 WP_Query::get_posts() 中调用
原文内容
Filters all query clauses at once, for convenience.
Description
For use by caching plugins.
Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT, fields (SELECT), and LIMIT clauses.
Parameters
$clausesstring[]-
Associative array of the clauses for the query.
wherestringThe WHERE clause of the query.groupbystringThe GROUP BY clause of the query.joinstringThe JOIN clause of the query.orderbystringThe ORDER BY clause of the query.distinctstringThe DISTINCT clause of the query.fieldsstringThe SELECT clause of the query.limitsstringThe LIMIT clause of the query.
$queryWP_Query-
The WP_Query instance (passed by reference).
Source
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |