WordPressの関数である「wp_insert_post」を使うことでcsvデータをカスタムフィールドに投稿することができる。
$post = array(
'post_author' => 1,
'post_content' => '[cft format=0]',
'post_status' => 'publish',
'post_title' => 'title',
);
$postid = wp_insert_post($post);
if($postid != 0){
update_post_meta($postid,"field1","◯◯");
update_post_meta($postid,"field2","◯◯");
これでカスタムフィールドの値をセットすることができる。
csvデータの場合、上記の処理をwhile文などでループをさせることでカスタムフィールドに投稿することができる。


