mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Pass post_type to clean_post_cache() instead of attempting to fetch a post object since the post may have been deleted.
Props leewillis77 see #19690 git-svn-id: https://develop.svn.wordpress.org/trunk@20423 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1583,10 +1583,7 @@ function wp_update_comment_count_now($post_id) {
|
||||
$new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
|
||||
$wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
|
||||
|
||||
if ( 'page' == $post->post_type )
|
||||
clean_page_cache( $post_id );
|
||||
else
|
||||
clean_post_cache( $post_id );
|
||||
clean_post_cache( $post_id, $post->post_type );
|
||||
|
||||
do_action('wp_update_comment_count', $post_id, $new, $old);
|
||||
do_action('edit_post', $post_id, $post);
|
||||
|
||||
Reference in New Issue
Block a user