I am developing a import plug in where I would upload a text file which contain all sorts of data about vehicle and that would insert that data in custom post type vehicle.
Now I am having problem inserting a category and its subcategory.
Like I have term audi and a term a3 I would like to add audi as category and a3 as its subcategory and assign to that post.
wp_set_object_terms( $news_arr, array(utf8_encode($news_arr),$news_arr), 'vehicle_models', $append = false ) ;
$news_arr are audi and a3 respectively.
I also tried
wp_insert_terms and set it parent as id of the first set object terms that creates a subcategory but does not assign to that post.
any help will be appreciated.