clean_comment_cache

函数
clean_comment_cache ( $ids )
参数
  • (int|array) $ids Comment ID or an array of comment IDs to remove from cache.
    Required:
定义位置
相关方法
clean_attachment_cacheclean_post_cacheupdate_comment_cache_prime_comment_cachesclean_page_cache
引入
2.3.0
弃用
-

clean_comment_cache: 这个函数清除了评论的缓存。评论是用户在一个文章或页面上产生的反馈: 当这个函数被调用时,它清除了所有评论数据的缓存。

从对象缓存中删除一个注释。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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' );
}
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' ); }
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' );
}

常见问题

FAQs
查看更多 >