0

I have a custom taxonomy registered as department, which works in other queries but it doesn't work when I use:

$args = array( 'child_of' => 483 , 'hide_empty' => false);
$subcats = get_terms( 'department', $args );

foreach( $subcats as $category ) {
    echo $category->name;
}

Once we remove child_of, it prints all the terms. Even using "parent" also not working. What am I missing here? In the database I can check that terms exist as hierarchy.

0

I got it solved on my own so, wanted to answer my own question.

in options table the results are cached, so I queried it and delete that.

SELECT * FROM `wp_options` WHERE `option_name` like '%department%'

department is my taxonomy name here.

You can check the function _get_term_hierarchy in taxonomy.php in wp-includes folder.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.