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()中評論的引數。

$comment_args = apply_filters( 'comments_template_query_args', $comment_args );

常見問題

FAQs
檢視更多 >