钩子文档

rest_get_max_batch_size

💡 云策文档标注

概述

rest_get_max_batch_size 是一个 WordPress 过滤器,用于设置 REST API 批处理请求中允许的最大请求数量。它允许开发者自定义批处理限制,默认值为 25。

关键要点

  • 这是一个过滤器钩子,用于修改 REST API 批处理的最大请求数。
  • 参数 $max_size 是一个整数,表示最大请求数量。
  • 默认值为 25,可以通过 apply_filters 进行覆盖。
  • 在 WordPress 5.6.0 版本中引入。
  • 与 WP_REST_Server::get_max_batch_size() 方法关联,用于获取当前设置的最大批处理大小。

代码示例

apply_filters( 'rest_get_max_batch_size', 25 );

📄 原文内容

Filters the maximum number of REST API requests that can be included in a batch.

Parameters

$max_sizeint
The maximum size.

Source

return apply_filters( 'rest_get_max_batch_size', 25 );

Changelog

Version Description
5.6.0 Introduced.