Retrieves a post meta field for the given post ID.
Parameters
$post_idintrequired
Post ID.
$keystringoptional
The meta key to retrieve. By default, returns data for all keys.
Default:''
$singlebooloptional
Whether to return a single value. This parameter has no effect if $key is not specified.
Default:false
Return
mixed An array of values if $single is false. The value of the meta field if $single is true. False for an invalid $post_id (non-numeric, zero, or negative value). An empty array if a valid but non-existing post ID is passed and $single is false. An empty string if a valid but non-existing post ID is passed and $single is true.
More Information
Please note that if a db collation is case insensitive (has with suffix _ci) then update_post_meta and delete_post_meta and get_posts() will update/delete/query the meta records with keys that are upper or lower case. However get_post_meta will apparently be case sensitive due to WordPress caching. See https://core.trac.wordpress.org/ticket/18210 for more info. Be careful not to mix upper and lowercase.