文章目录
本文最后更新于 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.0wp-includes/post.php:222821 function
CC 许可协议
署名-非商业性使用-相同方式共享 4.0 国际 了解协议
文章链接:https://zptheme.com/5479.html
本文作者:子佩·来源:子佩工作室

除非注明,子佩工作室 文章均为原创,转载请以链接形式标明本文地址。

相关推荐

登录后即可发表评论

社交账号登录

全部评论 (0)