rest_preprocess_comment

過濾鉤子
apply_filters( 'rest_preprocess_comment', $prepared_comment, $request )
引數
  • (array) $prepared_comment The prepared comment data for `wp_insert_comment`.
    Required:
  • (WP_REST_Request) $request The current request.
    Required:
定義位置
相關勾子
preprocess_commentrest_prepare_commentrest_prepare_attachmentrest_pre_insert_commentrest_delete_comment
相關方法
get_approved_commentsregister_block_core_commentsget_page_of_commentget_previous_comments_linkseparate_commentsregister_block_core_comment_date
引入
4.7.0
棄用
-

rest_preprocess_comment – 這個鉤子用於在評論插入資料庫之前修改評論資料結構。每當一個評論通過REST API提交,在插入資料庫之前,這個鉤子就會被觸發。它為開發者提供了一種方法來修改提交給API的評論的資料。

過濾通過REST API新增的評論,該評論已準備好插入資料庫中。

允許在為資料庫準備好評論後立即對其進行修改。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return apply_filters( 'rest_preprocess_comment', $prepared_comment, $request );
return apply_filters( 'rest_preprocess_comment', $prepared_comment, $request );
return apply_filters( 'rest_preprocess_comment', $prepared_comment, $request );

常見問題

FAQs
檢視更多 >