update_postmeta_cache

Updates metadata cache for list of post IDs.

Description

(array|false) update_postmeta_cache( (array) $post_ids ); 

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.

Returns (array|false)

Returns false if there is nothing to update or an array of metadata.

Parameters (1)

0. $post_ids (array)
List of post IDs.

Usage

  1. if ( !function_exists( 'update_postmeta_cache' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // List of post IDs. 
  5. $post_ids = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = update_postmeta_cache($post_ids); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function update_postmeta_cache( $post_ids ) { 
  2. return update_meta_cache('post', $post_ids);