Title: wp_update_comment_count
Published: April 25, 2014
Last modified: February 24, 2026

---

# do_action( ‘wp_update_comment_count’, int $post_id, int $new, int $old )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#parameters)󠁿

 `$post_id`int

Post ID.

`$new`int

The new comment count.

`$old`int

The old comment count.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#source)󠁿

    ```php
    do_action( 'wp_update_comment_count', $post_id, $new, $old );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/comment.php#L2893)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2893-L2893)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_update_comment_count_now()](https://developer.wordpress.org/reference/functions/wp_update_comment_count_now/)`wp-includes/comment.php` |

Updates the comment count for the post.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_update_comment_count/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_update_comment_count%2F)
before being able to contribute a note or feedback.