rest_insert_comment

動作鉤子
do_action( 'rest_insert_comment', $comment, $request, true )
引數
  • (WP_Comment) $comment Inserted or updated comment object.
    Required:
  • (WP_REST_Request) $request Request object.
    Required:
  • (bool) $creating True when creating a comment, false when updating.
    Required:
定義位置
相關勾子
rest_pre_insert_commentrest_after_insert_commentrest_insert_attachmentwp_insert_commentrest_delete_comment
相關方法
wp_insert_commentedit_commentwp_list_commentsget_next_comments_linkwp_new_commentwp_insert_attachment
引入
4.7.0
棄用
-

rest_insert_comment: 當通過REST API插入一個評論時,這個動作被觸發。它允許開發人員在插入評論時執行額外的動作,如更新相關資料或觸發通知。

在通過REST API建立或更新一個評論後發生觸發。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( 'rest_insert_comment', $comment, $request, true );
do_action( 'rest_insert_comment', $comment, $request, true );
do_action( 'rest_insert_comment', $comment, $request, true );

常見問題

FAQs
檢視更多 >