comment_{$new_status}_{$comment->comment_type}

動作鉤子
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment )
引數
  • (string) $comment_ID The comment ID as a numeric string.
    Required:
  • (WP_Comment) $comment Comment object.
    Required:
定義位置
相關勾子
get_avatar_comment_typescomment_atom_entryakismet_excluded_comment_typesget_comment_typeakismet_delete_commentmeta_batch
相關方法
_wp_batch_update_comment_typeget_comment_typefeed_content_typepost_comment_meta_box_theadwp_update_comment_countwp_update_comment_count_now
引入
2.7.0
棄用
-

comment_{$new_status}_{$comment->comment_type}: 當評論的狀態改變時,這個動作鉤子會被觸發。引數$new_status是評論的新狀態,而引數$comment->comment_type是評論的型別。

當一個特定的評論型別的狀態處於過渡期時發生觸發。

鉤子名稱的動態部分$new_status$comment->;comment_type,分別引用新註釋狀態和註釋型別。

典型的評論型別包括”評論”、”pingback”或”trackback”。

可能的鉤子名稱包括:

  • comment_approved_comment
  • comment_approved_pingback
  • comment_approved_trackback
  • comment_unapproved_comment
  • comment_unapproved_pingback
  • comment_unapproved_trackback
  • comment_spam_comment
  • comment_spam_pingback
  • comment_spam_trackback
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );

常見問題

FAQs
檢視更多 >