Reads a postmeta value directly from the master database.
This is not intended for front-end usage. This purpose of this function is to avoid race conditions that could appear while the caches are primed. A good scenario where this could be used is to ensure published posts are not syndicated multiple times by checking a postmeta flag that is set on syndication.
Note: this looks complicated, but the intention was to use API functions rather than direct DB queries for upward compatibility.
Parameters
Name | Type | Description |
---|---|---|
$post_id | int | The ID of the post from which you want the data. |
$key | string | A string containing the name of the meta value you want. |
$single | bool | Optional. If set to true then the function will return a single result as a string. If false (the default) the function returns an array. |
Return Value
mixed: Value from get_post_meta