Using a built in wordpress function (if available) how do I c开发者_运维百科reate a new category in wordpress if it doesn't exist.
I'm using wp_insert_post to insert posts, but I want to be able to do custom categories.
Thanks
-Brad
You can use wp_create_categories('catname') and to get_cat_ID('catname') to get the id.
wp_create_categories
get_cat_ID
精彩评论