comments_template_top_level_query_args
云策文档标注
概述
本文档介绍 comments_template_top_level_query_args 过滤器,用于修改顶级评论查询的参数。该过滤器在 WordPress 5.6.0 中引入,与 WP_Comment_Query 类相关。
关键要点
- 过滤器名称:comments_template_top_level_query_args
- 用途:过滤顶级评论查询的参数,影响评论模板的加载
- 参数:$top_level_args(数组,顶级查询参数),包含 count、orderby、post_id、status 等字段
- 相关函数:comments_template() 用于加载评论模板
- 版本:WordPress 5.6.0 引入
代码示例
$top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args );
原文内容
Filters the arguments used in the top level comments query.
Description
See also
Parameters
$top_level_argsarray-
The top level query arguments for the comments template.
countboolWhether to return a comment count.orderbystring|arrayThe field(s) to order by.post_idintThe post ID.statusstring|arrayThe comment status to limit results by.
Source
$top_level_args = apply_filters( 'comments_template_top_level_query_args', $top_level_args );
Changelog
| Version | Description |
|---|---|
| 5.6.0 | Introduced. |