GeekerCode更好的WordPress主题,值得信任的WordPress主题开发商

极美的主题、极致的插件

WordPress创建分类函数:wp_create_category()

摘要:【函数介绍】wp_create_category() 用于创建新分类,可指定父类【函数用法】<?php wp_create_category( $cat_name, $parent ); ?>【参数】$cat_n

【函数介绍】

wp_create_category() 用于创建新分类,可指定父类

【函数用法】

<?php wp_create_category( $cat_name, $parent ); ?>

【参数】

$cat_name

(string) (必须) 创建的新分类名.

默认: None

$parent

(integer) (可选) 父类ID.

默认: None

【返回值】

(integer)

返回新创建的分类ID,如果创建失败则返回0.

【示例】

<?php
   //创建新分类, 分类名为My category name
   wp_create_category('My category name');
?>

建站!你有充足的理由选择我们

世界上超过30%的网站是由WordPress搭建,而我们是国内最靠谱的WordPress主题开发商
QQ咨询在线咨询问答互助微信号geekercode微信公众号云服务器