rest_comment_collection_params
云策文档标注
概述
rest_comment_collection_params 是一个 WordPress REST API 过滤器,用于修改评论控制器的集合参数。它允许开发者自定义评论集合的查询参数,但不直接映射到 WP_Comment_Query 内部参数。
关键要点
- 此过滤器用于注册和调整 REST API 中评论控制器的集合参数,基于 JSON Schema 格式。
- 它不自动映射到 WP_Comment_Query 参数;如需设置 WP_Comment_Query 参数,应使用 rest_comment_query 过滤器。
- 过滤器在 WP_REST_Comments_Controller::get_collection_params() 方法中被调用,用于检索集合的查询参数。
- 自 WordPress 4.7.0 版本引入。
原文内容
Filters REST API collection parameters for the comments controller.
Description
This filter registers the collection parameter, but does not map the collection parameter to an internal WP_Comment_Query parameter. Use the rest_comment_query filter to set WP_Comment_Query parameters.
Parameters
$query_paramsarray-
JSON Schema-formatted collection parameters.
Source
return apply_filters( 'rest_comment_collection_params', $query_params );
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |