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. git-svn-id: https://develop.svn.wordpress.org/trunk@37614 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ecd5e349a6
commit
b3dcb1ad05
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user