WordPress Version: 6.1
//
// Post-meta: Custom per-post fields.
//
/**
* Retrieves post custom meta data field.
*
* @since 1.5.0
*
* @param string $key Meta data key name.
* @return array|string|false Array of values, or single value if only one element exists.
* False if the key does not exist.
*/
function post_custom($key = '')
{
$custom = get_post_custom();
if (!isset($custom[$key])) {
return false;
} elseif (1 === count($custom[$key])) {
return $custom[$key][0];
} else {
return $custom[$key];
}
}