trash_comment

動作鉤子
do_action( 'trash_comment', $comment->comment_ID, $comment )
引數
  • (string) $comment_id The comment ID as a numeric string.
    Required:
  • (WP_Comment) $comment The comment to be trashed.
    Required:
定義位置
相關勾子
untrash_commenttrashed_commentuntrashed_commentget_commentedit_comment
相關方法
wp_trash_commentwp_untrash_commentthe_commentget_commentwp_trash_post_commentsget_comments
引入
4.9.0
棄用
-

trash_comment – 這是一個WordPress的動作,當一個評論被移到垃圾桶時被觸發。trash_comment動作是在評論被移到垃圾桶之前觸發的,可以用來執行額外的動作,例如傳送電子郵件通知或更新其他資料。這個動作對於跟蹤被移到垃圾桶的評論,以及根據需要執行額外的動作非常有用。它可以和trashed_comment動作一起使用,在評論被移到垃圾桶之前和之後都可以執行動作。

在評論被送入回收站之前立即觸發。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( 'trash_comment', $comment->comment_ID, $comment );
do_action( 'trash_comment', $comment->comment_ID, $comment );
do_action( 'trash_comment', $comment->comment_ID, $comment );

常見問題

FAQs
檢視更多 >