开发者

how do I programically create a category in WordPress if it doesn't exist already?

开发者 https://www.devze.com 2023-01-01 09:06 出处:网络
Using a built in wordpress function (if available) how do I c开发者_运维百科reate a new category in wordpress if it doesn\'t exist.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消