Here is my solution to inserting terms in an Hierarchical Taxonomy:
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(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.