以下のコードを参考にしてCSVファイルをWPに読み込むことが出来る。

require('/var/www/html/wp-load.php');
$fdata = fopen("/var/www/html/propertylist.csv","r");
    if(($fdata = fopen("/var/www/html/propertylist.csv","r")) !== FALSE){
        while (($data=fgetcsv($fdata,1000,",")) !== FALSE){
            $post = array(
                'post_author' => 1,
                'post_title' => $data[1],
                'post_content' => '[cft format=0]' ,
                'post_status' => 'publish'
            );
            $postid = wp_insert_post($post);
            $propcontent = array(
                "rent"=> $data[2],
                "room_layout"=> $data[3],
                "square_meters"=> $data[4]
            );
            //var_dump($data);
            if($postid !== 0){
                update_post_meta($postid,"rent",$propcontent["rent"]);
                update_post_meta($postid,"room_layout",$propcontent["room_layout"]);
                update_post_meta($postid,"square_meters",$propcontent["square_meters"]);
            }        
        }
    }
fclose($fdata);

関連記事