| 503 | | $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); |
|---|
| 504 | | $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'"); |
|---|
| 505 | | $comment_count_cache[$post_id] = $count; |
|---|
| 506 | | |
|---|
| 507 | | $post = get_post($post_id); |
|---|
| | 503 | if ( !$post = get_post($post_id) ) |
|---|
| | 504 | return false; |
|---|
| | 505 | |
|---|
| | 506 | $old = (int) $post->comment_count; |
|---|
| | 507 | $new = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); |
|---|
| | 508 | $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$new' WHERE ID = '$post_id'"); |
|---|
| | 509 | $comment_count_cache[$post_id] = $new; |
|---|
| | 510 | |
|---|