post_meta_cache is one more global variable used for caching as Wordpress. It is a multi-dimensional array which stores the custom fields for a post. The custom fields are stored by the post ID and then by the custom field key. Multiple instances of custom fields are allowed.
Plugin and theme developers need not access post_meta_cache directly, it is used by Wordpress internally in the following internal and template functions.
Internal Functions
add_post_meta($post_id, $key, $value, $unique = false): adds custom field with specified key and value to the specified post. Ifuniqueis true, another custom field with duplicate key is not added. This can be used by developers who are developing plugins for the the admin area, especially for adding more information to the post structure.delete_post_meta($post_id, $key, $value): deletes the custom field with specified key and value from the specified post.get_post_meta($post_id, $key, $single = false): returns custom field value for specified key for the specified post.update_post_meta($post_id, $key, $value, $prev_value = ''): updates the custom field value for specified key in the specified post.
Template Functions
get_post_custom($post_id = 0): returns all the custom fields for specified post as an array. If post ID is not specified, current post is considered.get_post_custom_keys(): returns keys of all the custom fields for specified post as an arrayget_post_custom_values($key = ''): returns all values of the specified custom fields key for specified post as an arraypost_custom($key = ''): returns all the custom fields with specified key for the current post.the_meta(): displays all the custom fields of the current post as a unordered list.
Back to full list of global variables.
Technorati tags: post_meta_cache, custom fields, post meta
