comment_(new_status)_(comment_type)
Fires when the status of a specific comment type is in transition.
The dynamic portions of the hook name, $new_status, and $comment->comment_type, refer to the new comment status, and the type of comment, respectively.
Typical comment types include 'comment', 'pingback', or 'trackback'.
Possible hook names include:
- 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
Использование
add_action( 'comment_(new_status)_(comment_type)', 'wp_kama_comment_new_status_type_action', 10, 2 ); /** * Function for `comment_(new_status)_(comment_type)` action-hook. * * @param string $comment_id The comment ID as a numeric string. * @param WP_Comment $comment Comment object. * * @return void */ function wp_kama_comment_new_status_type_action( $comment_id, $comment ){ // action... }
- $comment_id(строка)
- The comment ID as a numeric string.
- $comment(WP_Comment)
- Comment object.
Список изменений
С версии 2.7.0 | Введена. |
Где вызывается хук
comment_(new_status)_(comment_type)
wp-includes/comment.php 1864
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
Где используется хук в WordPress
wp-includes/blocks/comments.php 121
add_filter( 'comment_form_defaults', 'comments_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 36
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 42
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/default-filters.php 258
add_filter( 'comment_author_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 259
add_filter( 'comment_text_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 260
add_filter( 'comment_text_rss', 'esc_html' );
wp-includes/default-filters.php 261
add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
wp-includes/default-filters.php 304
add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 );