clean_comment_cache() WP 2.3.0
Удаляет объектный кэш указанного комментария.
Не будет работать, если $_wp_suspend_cache_invalidation не пуста. Смотрите: wp_suspend_cache_invalidation().
Кэш поста можно очистить через функцию clean_post_cache().
Хуки из функции
Возвращает
Null. Ничего.
Использование
clean_comment_cache( $ids );
- $ids(число/массив) (обязательный)
- ID комментария кэш которого нужно удалить. Можно указать массив из нескольких ID.
Примеры
#1 Очистим кэш записи
Допустим, мы редактируем комментарий 25 и нам нужно очистить его кэш:
clean_comment_cache( 25 );
Очистим кэш комментариев 25 и 34:
clean_comment_cache( [ 25, 34 ] );
Список изменений
С версии 2.3.0 | Введена. |
Код clean_comment_cache() clean comment cache WP 5.6
function clean_comment_cache( $ids ) {
foreach ( (array) $ids as $id ) {
wp_cache_delete( $id, 'comment' );
/**
* 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' );
}Cвязанные функции
Из метки: cache (кэш кеш)
- _prime_post_caches()
- clean_post_cache()
- clean_user_cache()
- wp_cache_add()
- wp_cache_add_global_groups()
- wp_cache_add_non_persistent_groups()
Еще из метки: comment (комментарии)
- comment_link()
- comments_template()
- get_comment_author()
- get_comment_author_link()
- get_comment_author_url()
- get_comment_excerpt()