comments_template_query_args

过滤钩子
apply_filters( 'comments_template_query_args', $comment_args )
参数
  • (array) $comment_args { Array of WP_Comment_Query arguments. @type string|array $orderby Field(s) to order by. @type string $order Order of results. Accepts 'ASC' or 'DESC'. @type string $status Comment status. @type array $include_unapproved Array of IDs or email addresses whose unapproved comments will be included in results. @type int $post_id ID of the post. @type bool $no_found_rows Whether to refrain from querying for found rows. @type bool $update_comment_meta_cache Whether to prime cache for comment meta. @type bool|string $hierarchical Whether to query for comments hierarchically. @type int $offset Comment offset. @type int $number Number of comments to fetch. }
    Required:
定义位置
相关勾子
comments_template_top_level_query_argscomments_list_table_query_argscomments_templatecomment_reply_link_argscomments_per_page
相关方法
comments_templateget_template_hierarchycomment_text_rssget_template_directory_uriwp_removable_query_argsget_comments_popup_template
引入
4.5.0
弃用
-

comments_template_query_args是一个过滤器钩子,它允许开发者在检索文章的评论时修改传递给WP_Comment_Query类的参数。默认情况下,WordPress为一篇文章检索所有被批准的评论,但开发者可以使用这个钩子来定制查询。

过滤用于查询comments_template()中评论的参数。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$comment_args = apply_filters( 'comments_template_query_args', $comment_args );
$comment_args = apply_filters( 'comments_template_query_args', $comment_args );
$comment_args = apply_filters( 'comments_template_query_args', $comment_args );

常见问题

FAQs
查看更多 >
闪电伯伯

(工作日 10:00 - 18:30 为您服务)

2025-11-01 22:19:47

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: