Changeset 5869 for trunk/wp-includes/comment.php
- Timestamp:
- 08/14/2007 03:08:44 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r5772 r5869 501 501 if ( !$post_id ) 502 502 return false; 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 508 511 if ( 'page' == $post->post_type ) 509 512 clean_page_cache( $post_id ); … … 511 514 clean_post_cache( $post_id ); 512 515 513 do_action('edit_post', $post_id); 516 do_action('wp_update_comment_count', $post_id, $new, $old); 517 do_action('edit_post', $post_id, $post); 514 518 515 519 return true;
Note: See TracChangeset
for help on using the changeset viewer.