wp_update_comment_count
Fires immediately after a post's comment count is updated in the database.
Description
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.
- // run the action
- do_action( 'wp_update_comment_count', $post_id, $new, $old );
- The following example is for adding a hook callback.
- // define the wp_update_comment_count callback
- function action_wp_update_comment_count( $post_id, $new, $old ) {
- // make action magic happen here...
- };
- // add the action
- add_action( 'wp_update_comment_count', 'action_wp_update_comment_count', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the action
- 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
- do_action( 'wp_update_comment_count', $post_id, $new, $old );