I need to add a function to create automatically a child category. I just create manually the parent category.
I tried to use: wp_create_category but the include is not working.
$cat_name = “week_3”;
$post_categories_week = wp_create_category( $cat_name, $parent_cat_id );
wp_set_post_categories( $post_id, $post_categories_week );
the error message: Call to undefined function wp_create_category()
BUT I just include:
the documentation I found online said that this function should be in taxonomy.php, but I didn’t find in it. Why?
- The topic ‘Not able to create new category via script’ is closed to new replies.