Make WordPress Core

Changeset 36405


Ignore:
Timestamp:
01/26/2016 03:46:40 AM (8 years ago)
Author:
ericlewis
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r36325 r36405  
    25172517
    25182518/**
    2519  * Removes comment ID from the comment cache.
     2519 * Removes a comment from the object cache.
    25202520 *
    25212521 * @since 2.3.0
    25222522 *
    2523  * @param int|array $ids Comment ID or array of comment IDs to remove from cache
     2523 * @param int|array $ids Comment ID or an array of comment IDs to remove from cache.
    25242524 */
    25252525function clean_comment_cache($ids) {
    25262526    foreach ( (array) $ids as $id ) {
    25272527        wp_cache_delete( $id, 'comment' );
     2528
     2529        /**
     2530         * Fires after a comment has been removed from the object cache.
     2531         *
     2532         * @since 4.5.0
     2533         *
     2534         * @param int $id Comment ID.
     2535         */
     2536        do_action( 'clean_comment_cache', $id );
    25282537    }
    25292538
Note: See TracChangeset for help on using the changeset viewer.