
如何修复MAMP中Apache服务器未启动错误
wp_create_category ( $cat_name, $category_parent = 0 )
wp_create_category: 这是一个创建新类别的函数。它可以用来以编程方式创建一个类别,而不是在WordPress仪表盘上手动创建。
在数据库中添加一个新的类别,如果它还不存在的话。
function wp_create_category( $cat_name, $category_parent = 0 ) { $id = category_exists( $cat_name, $category_parent ); if ( $id ) { return $id; } return wp_insert_category( array( 'cat_name' => $cat_name, 'category_parent' => $category_parent, ) ); }