函数原型
get_post_custom_keys( int $post_id ): array|void
函数描述
Retrieves meta field names for a post.
是否弃用
未弃用
函数参数
-
$post_id
int
Optional - Post ID. Default is the ID of the global
$post.
函数返回值
array|void Array of the keys, if retrieved.
函数位置
File: wp-includes/post.php.
函数源码
function get_post_custom_keys( $post_id = 0 ) {
$custom = get_post_custom( $post_id );
if ( ! is_array( $custom ) ) {
return;
}
$keys = array_keys( $custom );
if ( $keys ) {
return $keys;
}
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |

