钩子文档

post_limits_request

💡 云策文档标注

概述

post_limits_request 是一个 WordPress 过滤器,用于修改查询中的 LIMIT 子句,主要供缓存插件使用。

关键要点

  • 过滤器名称:post_limits_request
  • 用途:过滤查询的 LIMIT 子句,常用于缓存插件优化查询
  • 参数:$limits(字符串,LIMIT 子句)和 $query(WP_Query 实例,引用传递)
  • 调用方式:通过 apply_filters_ref_array 应用,例如 $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) )
  • 相关函数:WP_Query::get_posts() 用于基于查询变量检索文章数组
  • 引入版本:WordPress 2.5.0

📄 原文内容

Filters the LIMIT clause of the query.

Description

For use by caching plugins.

Parameters

$limitsstring
The LIMIT clause of the query.
$queryWP_Query
The WP_Query instance (passed by reference).

Source

$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );

Changelog

Version Description
2.5.0 Introduced.