post_custom( string $key = '' )
Retrieve post custom meta data field.
Description Description
Parameters Parameters
- $key
-
(string) (Optional) Meta data key name.
Default value: ''
Return Return
(false|string|array) Array of values or single value, if only one element exists. False will be returned if key does not exist.
Source Source
File: wp-includes/post-template.php
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 ];
}
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |