函数原型
has_meta( int $postid ): array[]
函数描述
Returns meta data for the given post ID.
是否弃用
未弃用
函数参数
-
$postid
int
Required - A post ID.
函数返回值
array[] Array of meta data arrays for the given post ID.
...$0arrayAssociative array of meta data.meta_keystringMeta key.meta_valuemixedMeta value.meta_idstringMeta ID as a numeric string.post_idstringPost ID as a numeric string.
函数位置
File: wp-admin/includes/post.php.
函数源码
function has_meta( $postid ) {
global $wpdb;
return $wpdb->get_results(
$wpdb->prepare(
"SELECT meta_key, meta_value, meta_id, post_id
FROM $wpdb->postmeta WHERE post_id = %d
ORDER BY meta_key,meta_id",
$postid
),
ARRAY_A
);
}
源码链接
变更日志
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |

