Changeset 36318 for trunk/src/wp-includes/comment.php
- Timestamp:
- 01/15/2016 01:41:35 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r36272 r36318 2095 2095 2096 2096 $old = (int) $post->comment_count; 2097 $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) ); 2097 2098 /** 2099 * Filters a post's comment count before it is updated in the database. 2100 * 2101 * @since 4.5.0 2102 * 2103 * @param int $new The new comment count. Default null. 2104 * @param int $old The old comment count. 2105 * @param int $post_id Post ID. 2106 */ 2107 $new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id ); 2108 2109 if ( is_null( $new ) ) { 2110 $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) ); 2111 } else { 2112 $new = (int) $new; 2113 } 2114 2098 2115 $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); 2099 2116
Note: See TracChangeset
for help on using the changeset viewer.