clean_comment_cache

Removes a comment from the object cache.

Description

clean_comment_cache( (int|array) $ids ); 

Parameters (1)

0. $ids (int|array)
Comment ID or an array of comment IDs to remove from cache.

Usage

  1. if ( !function_exists( 'clean_comment_cache' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment.php'; 
  3.  
  4. // Comment ID or an array of comment IDs to remove from cache. 
  5. $ids = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = clean_comment_cache($ids); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment.php  
  1. function clean_comment_cache($ids) { 
  2. foreach ( (array) $ids as $id ) { 
  3. wp_cache_delete( $id, 'comment' ); 
  4.  
  5. /** 
  6. * Fires immediately after a comment has been removed from the object cache. 
  7. * @since 4.5.0 
  8. * @param int $id Comment ID. 
  9. */ 
  10.  
  11. wp_cache_set( 'last_changed', microtime(), 'comment' );