İşlemin tam olduğu kodu atarsan inceleyeyim, gönderdiğim kod istediğini yapması gerekir.
bu kategorilerin alındığı kod.
$regexpet2 = '(<li><h3>Kategoriler</h3>(.*?)</li>)';
preg_match($regexpet2, $tekrargo, $bkat);
$cats = explode(",", strip_tags($bkat[1]));
foreach($cats as $cat){
$catler[] = wp_create_category($cat);
}bu da veritabanına yazma kısmı.
$my_post = array();
$my_post['post_title'] = $baslik;
$my_post['post_content'] = $icerik;
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_category'] = array($catler);
$postid = wp_insert_post($my_post);