wp_update_comment_count
Fires immediately after a post's comment count is updated in the database.
Usage
add_action( 'wp_update_comment_count', 'wp_kama_update_comment_count_action', 10, 3 ); /** * Function for `wp_update_comment_count` action-hook. * * @param int $post_id Post ID. * @param int $new The new comment count. * @param int $old The old comment count. * * @return void */ function wp_kama_update_comment_count_action( $post_id, $new, $old ){ // action... }
- $post_id(int)
- Post ID.
- $new(int)
- The new comment count.
- $old(int)
- The old comment count.
Changelog
Since 2.3.0 | Introduced. |
Where the hook is called
wp-includes/comment.php 2768
do_action( 'wp_update_comment_count', $post_id, $new, $old );