也许有更好的方法可以做到这一点,但这应该是可行的:
$the_terms = get_terms( \'category\', \'child_of=<replace with parent id>\' );
$included_terms = array(\'<replace with parent id>\' );
if( $the_terms )
{
foreach( $the_terms as $the_term )
$included_terms[] = $the_term->term_id;
}
sort( $included_terms );
wp_list_categories(
\'include\' => $included_terms
);
这样可以确保您不必更新ID列表