$term_list[] =
$term->term_id;
} else { $term_list[] =
$term;
} if ( !
isset( $has_children[ $term->term_id
] ) ) { continue;
} $ancestors[ $term->term_id
] = 1;
$children =
_get_term_children( $term->term_id,
$terms,
$taxonomy,
$ancestors );
if ( $children ) { $term_list =
array_merge( $term_list,
$children );
} } } return $term_list;
}/**
* Adds count of children to parent count.
*
* Recalculates term counts by including items from child terms. Assumes all
* relevant children are already in the $terms argument.
*
* @access private
* @since 2.3.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param object[]|WP_Term[] $terms List of term objects (passed by reference).
* @param string $taxonomy Term context.
*/