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 1845
do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );

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

wp-includes/blocks/comments.php 113
add_filter( 'comment_form_defaults', 'comments_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 34
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/blocks/post-comments-form.php 40
remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
wp-includes/default-filters.php 255
add_filter( 'comment_author_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 256
add_filter( 'comment_text_rss', 'ent2ncr', 8 );
wp-includes/default-filters.php 257
add_filter( 'comment_text_rss', 'esc_html' );
wp-includes/default-filters.php 258
add_filter( 'comment_text_rss', 'wp_staticize_emoji' );
wp-includes/default-filters.php 300
add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 );