$taxonomy_children option is not updated after wp_insert_term
|Reported by:||acsnaterse||Owned by:|
When using wp_insert_term or wp_update_term the $taxonomy_children option is not set properly. This should be done in the _get_term_hierarchy function, but I think the following line gives a problem:
if ( is_array($children) ) return $children;
It checks whether it's an array or not, but this means when the array is empty (due to manually deleting all the terms in the Admin) it also returns. And therefor it doesn't update anymore.
I think the check must be whether it's an array or not and if it is, it should also check whether the array is empty or not. So something like this:
if ( is_array($children) && !empty($children) ) return $children;