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
檢視更多 >