taxonomy – get_terms of specific parent (including parent itself)

I don’t think there is any way you can set the arguments such that you can get a word and all the children of that word in one call, so you will probably have to deal with the parent as a separate call .

using the get_terms so for kids get_term,

$parent_id = 100; // set as appropriate
$terms = get_terms( array(
    'taxonomy' => 'YOURTAX',
    'hide_empty' => false, // omit if not applicable (used for testing)
    'child_of' => $parent_id,
) );

$terms[] = get_term( $parent_id, 'YOURTAX' );

Leave a Comment