post_custom()
最后更新于:2021-11-27 19:05:15
post_custom( string$key=”)Retrieve post custom meta data field.
参数
- $key
-
(string) (Optional) Meta data key name.
Default value: ”
响应
(array|string|false) Array of values, or single value if only one element exists. False if the key does not exist.
源文件
文件: gc-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 ];
}
}