I have written a script that takes an XML feed of some news, and inserts each news story as a post into WordPress using wp_insert_post().
Each of these news stories has a category that I would like to add to WordPress also.
My question is, how can I create NEW categories on the fly and assign the post to that category using wp_insert_post() (or any other function)?
Thanks!
I sorted it in the end by writing the following code:
Try this: