本文最后更新于 2022-10-17,已超过 365 天未更新,内容可能已失效。
get_post_custom_keys( int $post_id )
检索文章的元字段名。
Retrieve meta field names for a post.
说明(Description)
如果没有元字段,则不返回任何内容(空)。
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $post_id | (int) | 可选 | Post ID。默认值是全局$Post的ID。 |
返回(Return)
(array|void)键的数组(array|void)。
源码(Source)
/**
* Retrieve meta field names for a post.
*
* If there are no meta fields, then nothing (null) will be returned.
*
* @since 1.2.0
*
* @param int $post_id Optional. Post ID. Default is ID of the global $post.
* @return array|void Array of the keys, if retrieved.
*/
function get_post_custom_keys( $post_id = 0 ) {
$custom = get_post_custom( $post_id );
if ( !is_array($custom) )
return;
if ( $keys = array_keys($custom) )
return $keys;
}
| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.2.0 | wp-includes/post.php:2228 | 2 | 1 function |
除非注明,子佩工作室 文章均为原创,转载请以链接形式标明本文地址。



登录后即可发表评论
全部评论 (0)