函数原型
get_post_custom( int $post_id ): mixed
函数描述
Retrieves post meta fields, based on post ID.
是否弃用
未弃用
函数参数
-
$post_id
int
Optional - Post ID. Default is the ID of the global
$post.
函数返回值
mixed An array of values.
False for an invalid $post_id (non-numeric, zero, or negative value).
An empty string if a valid but non-existing post ID is passed.
函数位置
File: wp-includes/post.php.
函数源码
function get_post_custom( $post_id = 0 ) {
$post_id = absint( $post_id );
if ( ! $post_id ) {
$post_id = get_the_ID();
}
return get_post_meta( $post_id );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |

