posts_distinct_request
云策文档标注
概述
posts_distinct_request 是一个 WordPress 过滤器,用于修改查询中的 DISTINCT 子句,主要供缓存插件使用。
关键要点
- 过滤器名称:posts_distinct_request
- 用途:过滤查询的 DISTINCT 子句,常用于缓存插件优化
- 参数:$distinct(字符串,查询的 DISTINCT 子句)和 $query(WP_Query 实例,通过引用传递)
- 调用方式:apply_filters_ref_array()
- 引入版本:WordPress 2.5.0
代码示例
$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );注意事项
- 此过滤器在 WP_Query::get_posts() 方法中使用,开发者应谨慎修改以避免影响查询性能或结果。
原文内容
Filters the DISTINCT clause of the query.
Description
For use by caching plugins.
Parameters
Source
$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |