钩子文档

posts_join_request

💡 云策文档标注

概述

posts_join_request 是一个 WordPress 过滤器,用于修改查询中的 JOIN 子句。主要面向缓存插件开发者,允许在 WP_Query 执行时调整数据库连接逻辑。

关键要点

  • 过滤器名称:posts_join_request
  • 用途:过滤查询的 JOIN 子句,常用于缓存插件优化数据库查询
  • 参数:$join(JOIN 子句字符串)、$query(WP_Query 实例,通过引用传递)
  • 调用方式:apply_filters_ref_array('posts_join_request', array($join, &$this))
  • 相关函数:WP_Query::get_posts()
  • 引入版本:WordPress 2.5.0

📄 原文内容

Filters the JOIN clause of the query.

Description

For use by caching plugins.

Parameters

$joinstring
The JOIN clause of the query.
$queryWP_Query
The WP_Query instance (passed by reference).

Source

$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );

Changelog

Version Description
2.5.0 Introduced.