From 0efd5b3d001f4ec0e62afdff652cf9fb20f52718 Mon Sep 17 00:00:00 2001 From: Eric Lewis Date: Tue, 26 Jan 2016 03:47:25 +0000 Subject: [PATCH] Comments: Fire an action after a comment is removed from object cache. When a comment is removed from the object cache, the `clean_comment_cache` action is now fired. This provides plugin and theme developers a chance to perform secondary cache invalidation as needed. Props spacedmonkey. Fixes #35610. Built from https://develop.svn.wordpress.org/trunk@36405 git-svn-id: http://core.svn.wordpress.org/trunk@36372 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 13 +++++++++++-- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 3d1439a8a7..68ad759e97 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2516,15 +2516,24 @@ function xmlrpc_pingback_error( $ixr_error ) { // /** - * Removes comment ID from the comment cache. + * Removes a comment from the object cache. * * @since 2.3.0 * - * @param int|array $ids Comment ID or array of comment IDs to remove from cache + * @param int|array $ids Comment ID or an array of comment IDs to remove from cache. */ function clean_comment_cache($ids) { foreach ( (array) $ids as $id ) { wp_cache_delete( $id, 'comment' ); + + /** + * Fires after a comment has been removed from the object cache. + * + * @since 4.5.0 + * + * @param int $id Comment ID. + */ + do_action( 'clean_comment_cache', $id ); } wp_cache_set( 'last_changed', microtime(), 'comment' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e637baf74b..ca7e5c58fb 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36404'; +$wp_version = '4.5-alpha-36405'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.