Title: update_postmeta_cache
Published: April 25, 2014
Last modified: February 24, 2026

---

# update_postmeta_cache( int[] $post_ids ): array|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#wp--skip-link--target)

Updates metadata cache for a list of post IDs.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#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.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#parameters)󠁿

 `$post_ids`int[]required

Array of post IDs.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#return)󠁿

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

## 󠀁[Source](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/post.php#L7870)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/post.php#L7870-L7872)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#related)󠁿

| Uses | Description | 
| [update_meta_cache()](https://developer.wordpress.org/reference/functions/update_meta_cache/)`wp-includes/meta.php` |

Updates the metadata cache for the specified objects.

  |

| Used by | Description | 
| [update_post_caches()](https://developer.wordpress.org/reference/functions/update_post_caches/)`wp-includes/post.php` |

Updates post, term, and metadata caches for a list of post objects.

  | 
| [_prime_post_caches()](https://developer.wordpress.org/reference/functions/_prime_post_caches/)`wp-includes/post.php` |

Adds any posts from the given IDs to the cache that do not already exist in cache.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/update_postmeta_cache/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fupdate_postmeta_cache%2F)
before being able to contribute a note or feedback.