rest_comment_query

過濾鉤子
apply_filters( 'rest_comment_query', $prepared_args, $request )
引數
  • (array) $prepared_args Array of arguments for WP_Comment_Query.
    Required:
  • (WP_REST_Request) $request The REST API request.
    Required:
定義位置
相關勾子
get_comments_numberpre_comment_user_iprest_user_queryget_comment_authorget_comment_date
相關方法
get_comments_numberget_comment_authorget_comment_typeget_comment_metaget_comment_textget_comment_time
引入
4.7.0
棄用
-

rest_comment_query – 這個鉤子用來過濾在WordPress REST API中查詢評論時使用的引數。開發人員可以使用這個鉤子來修改查詢中使用的引數,比如要檢索的評論的數量或返回的順序。

當通過REST API查詢評論時,過濾WP_Comment_Query_Query。

$prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );

常見問題

FAQs
檢視更多 >