PARENT_CAT wp_insert_term Parent_category_NAME category array slug Par

1
2
3
4
5
6
7
$PARENT_CAT= wp_insert_term('Parent_category_NAME','category', array('slug'=> 'Parent_category_NAME'));
delete_option("category_children");
wp_cache_flush();
$child= wp_insert_term('children_category_NAME','category',array( 'slug'=>'children_category_NAME', 'parent' =>$PARENT_CAT['term_id']));
delete_option("category_children");
wp_cache_flush();