W3cubDocs

/WordPress

update_post_cache( WP_Post[] $posts )

Updates posts in cache.

Parameters

$posts

(WP_Post[]) (Required) Array of post objects (passed by reference).

Source

File: wp-includes/post.php

function update_post_cache( &$posts ) {
	if ( ! $posts ) {
		return;
	}

	foreach ( $posts as $post ) {
		wp_cache_add( $post->ID, $post, 'posts' );
	}
}

Changelog

Version Description
1.5.1 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_post_cache