diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index a84f0a7..b64fda3 100644
|
|
function wp_update_comment_count_now($post_id) { |
2052 | 2052 | |
2053 | 2053 | $old = (int) $post->comment_count; |
2054 | 2054 | $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); |
| 2055 | |
| 2056 | /** |
| 2057 | * Filters a post's comment count before it is updated in the database. |
| 2058 | * |
| 2059 | * @since 4.5.0 |
| 2060 | * |
| 2061 | * @param int $post_id Post ID. |
| 2062 | * @param int $new The new comment count. |
| 2063 | * @param int $old The old comment count. |
| 2064 | */ |
| 2065 | $new = (int) apply_filters( 'wp_update_comment_count_new', $post_id, $new, $old ); |
| 2066 | |
2055 | 2067 | $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); |
2056 | 2068 | |
2057 | 2069 | clean_post_cache( $post ); |