钩子文档

posts_where_request

💡 云策文档标注

概述

posts_where_request 是一个 WordPress 过滤器,用于修改查询的 WHERE 子句。它主要供缓存插件使用,允许开发者自定义查询条件。

关键要点

  • 过滤器名称:posts_where_request
  • 用途:过滤查询的 WHERE 子句,常用于缓存插件优化
  • 参数:$where(WHERE 子句字符串)和 $query(WP_Query 实例,引用传递)
  • 调用方式:通过 apply_filters_ref_array 应用
  • 相关函数:WP_Query::get_posts()
  • 引入版本:WordPress 2.5.0

📄 原文内容

Filters the WHERE clause of the query.

Description

For use by caching plugins.

Parameters

$wherestring
The WHERE clause of the query.
$queryWP_Query
The WP_Query instance (passed by reference).

Source

$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );

Changelog

Version Description
2.5.0 Introduced.