From c70e3246e2ed5ffd1ce26924eadb7c67a1eadf40 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 1 Jun 2016 21:56:27 +0000 Subject: [PATCH] Use `clean_comment_cache()` in `wp_insert_comment()`. Previously, only the 'last_changed' incrementor was manually invalidated, since the newly created comment did not yet exist in the cache. However, this created an inconsistency with the other comment CRUD functions, which result in the 'clean_comment_cache' action firing. Props spacedmonkey. See #36906. Built from https://develop.svn.wordpress.org/trunk@37614 git-svn-id: http://core.svn.wordpress.org/trunk@37582 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 68cc772e93..a7282e4e95 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1588,6 +1588,9 @@ function wp_insert_comment( $commentdata ) { if ( $comment_approved == 1 ) { wp_update_comment_count( $comment_post_ID ); } + + clean_comment_cache( $id ); + $comment = get_comment( $id ); // If metadata is provided, store it. @@ -1607,8 +1610,6 @@ function wp_insert_comment( $commentdata ) { */ do_action( 'wp_insert_comment', $id, $comment ); - wp_cache_set( 'last_changed', microtime(), 'comment' ); - return $id; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 9a52c07b31..27c651cba0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37613'; +$wp_version = '4.6-alpha-37614'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.