On this page
clean_comment_cache( int|array $ids )
Removes a comment from the object cache.
Parameters
$idsint|array Required-
Comment ID or an array of comment IDs to remove from cache.
Source
File: wp-includes/comment.php. View all references
function clean_comment_cache( $ids ) {
$comment_ids = (array) $ids;
wp_cache_delete_multiple( $comment_ids, 'comment' );
foreach ( $comment_ids as $id ) {
/**
* Fires immediately 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' );
}
Hooks
- do_action( 'clean_comment_cache',
int $id ) -
Fires immediately after a comment has been removed from the object cache.
Related
Uses
| Uses | Description |
|---|---|
| wp_cache_delete_multiple() wp-includes/cache.php | Deletes multiple values from the cache in one call. |
| wp_cache_set() wp-includes/cache.php | Saves the data to the cache. |
| do_action() wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
Used By
| Used By | Description |
|---|---|
| _wp_batch_update_comment_type() wp-includes/comment.php | Updates the comment type for a batch of comments. |
| wp_comments_personal_data_eraser() wp-includes/comment.php | Erases personal data associated with an email address from the comments table. |
| wp_untrash_post_comments() wp-includes/post.php | Restores comments for a post from the Trash. |
| wp_trash_post_comments() wp-includes/post.php | Moves comments for a post to the Trash. |
| wp_set_comment_status() wp-includes/comment.php | Sets the status of a comment. |
| wp_update_comment() wp-includes/comment.php | Updates an existing comment in the database. |
| wp_insert_comment() wp-includes/comment.php | Inserts a comment into the database. |
| wp_delete_comment() wp-includes/comment.php | Trashes or deletes a comment. |
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/clean_comment_cache