这就是你想要的吗?在发布代码后使用它在循环中创建帖子,并使用它们的ID更新元字段。将“post_type”替换为自定义的post type。
foreach ($markers as $marker){
$post_id = wp_insert_post(array(
"post_title" => "something",
"post_type" => "your-type",
"post_status" => "publish", //by default they are drafts
// etc.
));
update_post_meta($post_id, "latitude", $marker[\'lat\']);
update_post_meta($post_id, "longitude", $marker[\'long\']);
}
之后,您可以使用
get_post_meta()