comment_{$old_status}_to_{$new_status}

動作鉤子
do_action( "comment_{$old_status}_to_{$new_status}", $comment )

comment_{$old_status}to{$new_status}: 當一個評論的狀態從一個狀態變為另一個狀態時,這個動作會被觸發。例如,如果一個評論的狀態從”待定”變為”批准”,將觸發”comment_pending_to_approved”動作。

當註釋狀態從一種特定狀態轉換到另一種狀態時觸發。

鉤子名稱的動態部分$old_status$snew_status分別引用舊註釋狀態和新註釋狀態。

可能的掛鉤名稱包括:

  • comment_unapproved_to_approved
  • comment_spam_to_approved
  • comment_approved_to_unapproved
  • comment_spam_to_unapproved
  • comment_unapproved_to_spam
  • comment_approved_to_spam
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( "comment_{$old_status}_to_{$new_status}", $comment );
do_action( "comment_{$old_status}_to_{$new_status}", $comment );
do_action( "comment_{$old_status}_to_{$new_status}", $comment );

常見問題

FAQs
檢視更多 >