Inserting Category programmatically
Keep track of the return value of wp_insert_term and use it to build your structure. A successful return value will be an array with a term_id key that you can pass into wp_insert_term‘s $args array as parent. $parent = wp_insert_term(‘Science’, ‘category’); // I’ll leave out `$args` here if (is_wp_error($parent)) { // insert didn’t work! return … Read more