wp_update_comment_count

Fires immediately after a post's comment count is updated in the database.

Description

do_action( 'wp_update_comment_count', (int) $post_id, (int) $new, (int) $old ); 

Parameters (3)

0. $post_id (int)
The post id.
1. $new (int)
The new comment count.
2. $old (int)
The old comment count.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'wp_update_comment_count', $post_id, $new, $old ); 
The following example is for adding a hook callback.
  1. // define the wp_update_comment_count callback 
  2. function action_wp_update_comment_count( $post_id, $new, $old ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'wp_update_comment_count', 'action_wp_update_comment_count', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'wp_update_comment_count', 'action_wp_update_comment_count', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/comment.php  
  1. do_action( 'wp_update_comment_count', $post_id, $new, $old );