This WordPress function requires the CPT-onomy class.


Merges all term children into a single array of their IDs.

This recursive function will merge all of the children of the term into the same array of term IDs. Only useful for taxonomies which are hierarchical.

Note: As of WordPress 3.3.2, CPT-onomies will work with get_term_children() but I’m not a fan of how WordPress stores the children ids in an option. I recommend that you continue to use $cpt_onomy->get_term_children().


$cpt_onomy->get_term_children( 						string|int
						, 						string


$term_id (string|integer) (required)
Default: none
The term's ID.

$cpt_onomy (string) (required)
Default: none
Name of the CPT-onomy that the term belongs to.

Return Values

(array|WP_Error) List of Term IDs. WP_Error returned if $cpt_onomy does not exist.


Get an array of children terms and display them, with links, in an unordered list.


global $cpt_onomy;
$taxonomy = 'actors';
$term_children = $cpt_onomy->get_term_children( 10, $taxonomy );

echo '<ul>';
foreach ( $term_children as $child ) {
   $term = $cpt_onomy->get_term_by( 'id', $child, $taxonomy );
   echo '<li><a href="' . $cpt_onomy->get_term_link( $term, $taxonomy ) . '">' . $term->name . '</a></li>';
echo '</ul>';


WordPress Codex

For more information, refer to the WordPress codex.