I’m trying to insert a term for a custom taxonomy and a custom post type in WordPress. The problem I’m running in to is that it successfully inserts a term, and at the right hierarchy level, but the term has no name. The line that inserts the term is:
$lasttermarray = wp_insert_term($categoryname, "department", array( "parent" => $parentcategory ) );
I’ve checked to make sure that both $categoryname and $parentcategory are set to the right values. Like I said, the term is being inserted, just with a blank name. The slug of the blank term is being set to the ID of the new term.
Is there any reason why the function would not be reading the name variable and causing it to do this? Thanks for your help.