mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 23:27:04 +00:00
More bonkers comment cache cleanup: toggle wp_defer_comment_counting() in wp_insert_post() and wp_insert_attachment(). Move the cache deletion in wp_update_comment_count_now() to before the get_post() call, so that the caches get deleted even if the post has already been deleted and the function returns early.
See #33875. git-svn-id: https://develop.svn.wordpress.org/trunk@34158 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1907,6 +1907,10 @@ function wp_update_comment_count_now($post_id) {
|
||||
$post_id = (int) $post_id;
|
||||
if ( !$post_id )
|
||||
return false;
|
||||
|
||||
wp_cache_delete( 'comments-0', 'counts' );
|
||||
wp_cache_delete( "comments-{$post_id}", 'counts' );
|
||||
|
||||
if ( !$post = get_post($post_id) )
|
||||
return false;
|
||||
|
||||
@@ -1916,9 +1920,6 @@ function wp_update_comment_count_now($post_id) {
|
||||
|
||||
clean_post_cache( $post );
|
||||
|
||||
wp_cache_delete( 'comments-0', 'counts' );
|
||||
wp_cache_delete( "comments-{$post_id}", 'counts' );
|
||||
|
||||
/**
|
||||
* Fires immediately after a post's comment count is updated in the database.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user