The "counts" cache for comments by post id is never invalidated. Neither wp_update_comment_count() nor wp_update_comment_count_now() touch the cache.

Adds unit test.
See #33875.


git-svn-id: https://develop.svn.wordpress.org/trunk@34131 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-14 22:03:23 +00:00
parent b42a906512
commit 545da32217
2 changed files with 51 additions and 1 deletions

View File

@@ -1916,6 +1916,8 @@ function wp_update_comment_count_now($post_id) {
clean_post_cache( $post );
wp_cache_delete( "comments-{$post_id}", 'counts' );
/**
* Fires immediately after a post's comment count is updated in the database.
*
@@ -2324,7 +2326,6 @@ function xmlrpc_pingback_error( $ixr_error ) {
function clean_comment_cache($ids) {
foreach ( (array) $ids as $id ) {
wp_cache_delete( $id, 'comment' );
wp_cache_delete( "comment-{$id}", 'counts' );
}
wp_cache_set( 'last_changed', microtime(), 'comment' );