diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
index 7dafa1e..f0b28bc 100644
a
|
b
|
function wp_update_comment_count_now($post_id) { |
2055 | 2055 | return false; |
2056 | 2056 | |
2057 | 2057 | $old = (int) $post->comment_count; |
2058 | | $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); |
| 2058 | |
| 2059 | /** |
| 2060 | * Filters a post's comment count before it is updated in the database. |
| 2061 | * |
| 2062 | * @since 4.5.0 |
| 2063 | * |
| 2064 | * @param null $new The new comment count. |
| 2065 | * @param int $old The old comment count. |
| 2066 | * @param int $post_id Post ID. |
| 2067 | */ |
| 2068 | $new = apply_filters( 'wp_update_comment_count_new', null, $old, $post_id ); |
| 2069 | |
| 2070 | if ( ( $new !== null ) && is_numeric( $new ) && ( 0 <= $new ) ) { |
| 2071 | $new = (int) $new; |
| 2072 | } |
| 2073 | else { |
| 2074 | $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); |
| 2075 | } |
| 2076 | |
2059 | 2077 | $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); |
2060 | 2078 | |
2061 | 2079 | clean_post_cache( $post ); |