WordPress saves all taxonomy children term ids in an option for caching purpose. The option is named "$taxonomy_children"
. This option is created when you use the function get_term_children
, but does not get updated that way. It’s only updated upon creating/updating parent or child term of that taxonomy using WP Admin UI.
Rather than using WP Admin UI, if you deleted a term some other way, the option exists and therefore display wrong children information upon using get_term_children
function. To solve this problem, you should manually delete the option named “$taxonomy_children” using the delete_option
function or directly from your phpMyAdmin