update_postmeta_cache() WordPress Function

update_postmeta_cache() is a function in WordPress that updates the postmeta cache for a given post ID. It is useful for when you need to retrieve postmeta values for a large number of posts, as it can be more efficient to first update the cache before retrieving the values.

update_postmeta_cache( int[] $post_ids ) #

Updates metadata cache for list of post IDs.


Description

Performs SQL query to retrieve the metadata for the post IDs and updates the metadata cache for the posts. Therefore, the functions, which call this function, do not need to perform SQL queries on their own.


Top ↑

Parameters

$post_ids

(int[])(Required)Array of post IDs.


Top ↑

Return

(array|false) An array of metadata on success, false if there is nothing to update.


Top ↑

Source

File: wp-includes/post.php

function update_postmeta_cache( $post_ids ) {
	return update_meta_cache( 'post', $post_ids );
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More