钩子文档

posts_where_paged

💡 云策文档标注

概述

posts_where_paged 是一个 WordPress 过滤器,用于修改查询中的 WHERE 子句,专门针对分页查询进行定制。

关键要点

  • 过滤器名称:posts_where_paged
  • 用途:过滤查询的 WHERE 子句,特别适用于分页查询场景
  • 参数:$where(WHERE 子句字符串)和 $query(WP_Query 实例,通过引用传递)
  • 源代码位置:在 WP_Query::get_posts() 中调用,通过 apply_filters_ref_array 应用
  • 引入版本:WordPress 1.5.0

📄 原文内容

Filters the WHERE clause of the query.

Description

Specifically for manipulating paging queries.

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_paged', array( $where, &$this ) );

Changelog

Version Description
1.5.0 Introduced.