wp_xmlrpc_server::获取自定义字段(整数 $帖子id ):阵列

检索帖子的自定义字段。

参数

$帖子id整数必需的
帖子ID。

返回

阵列自定义字段(如果存在)。

来源

公共函数get_custom_fields($post_id){$post_id=(int)$post_id;$custom_fields=数组();foreach((数组)将_meta($post_id)作为$meta){//不要暴露受保护的字段。if(!current_user_can('edit_post_meta',$post_id,$meta['meta_key'])){继续;}$custom_fields[]=数组(“id”=>$meta[“meta_id”],“key”=>$meta['meta_key'],“value”=>$meta['meta_value'],);}返回$custom_fields;}

变更日志

版本描述
2.5.0介绍。

用户贡献的笔记

你必须登录在能够发表注释或反馈之前。