posts_request_ids
云策文档标注
概述
posts_request_ids 是一个 WordPress 过滤器,用于在发送 Post IDs SQL 请求之前修改请求字符串。它允许开发者在 WP_Query 执行查询前干预 SQL 请求。
关键要点
- 过滤器名称:posts_request_ids
- 参数:$request(Post ID 请求字符串)和 $query(WP_Query 实例)
- 用途:过滤 Post IDs SQL 请求,常用于自定义查询逻辑或优化性能
- 相关函数:在 WP_Query::get_posts() 中调用,用于检索基于查询变量的文章数组
- 引入版本:WordPress 3.4.0
原文内容
Filters the Post IDs SQL request before sending.
Parameters
Source
$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |