WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

update_comment_cache() WP 2.3.0

Updates the comment cache of given comments.

Will add the comments in $comments to the cache. If comment ID already exists in the comment cache then it will not be updated. The comment is added to the cache using the comment group with the key using the ID of the comments.

Хуков нет.


Null. Ничего.


update_comment_cache( $comments, $update_meta_cache );
$comments(WP_Comment[]) (обязательный)
Array of comment objects
Whether to update commentmeta cache.
По умолчанию: true

Список изменений

С версии 2.3.0 Введена.
С версии 4.4.0 Introduced the $update_meta_cache parameter.

Код update comment cache: wp-includes/comment.php WP 5.3.2

function update_comment_cache( $comments, $update_meta_cache = true ) {
	foreach ( (array) $comments as $comment ) {
		wp_cache_add( $comment->comment_ID, $comment, 'comment' );

	if ( $update_meta_cache ) {
		// Avoid `wp_list_pluck()` in case `$comments` is passed by reference.
		$comment_ids = array();
		foreach ( $comments as $comment ) {
			$comment_ids[] = $comment->comment_ID;
		update_meta_cache( 'comment', $comment_ids );