comment_(new_status)_(comment_type) хук-событиеWP 2.7.0

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:

Использование

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 Введена.

Где вызывается хук

wp_transition_comment_status()
comment_(new_status)_(comment_type)
wp-includes/comment.php 1843
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );

Где используется хук в WordPress

wp-includes/blocks/post-comments-form.php 32
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 38
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments.php 85
add_filter( 'comment_form_defaults', 'post_comments_block_form_defaults' );
wp-includes/default-filters.php 246
add_filter( 'comment_author_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 247
add_filter( 'comment_text_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 248
add_filter( 'comment_text_rss', 'esc_html' );
wp-includes/default-filters.php 249
add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
wp-includes/default-filters.php 291
add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 );