I have a for each statement that looks for a Taxonomy by ID and gets all termchildren and lists them using a foreach loop. I’m trying to figure out how to order them alphabetically by title. Here’s my code:
$termID = 5;
$taxonomyName = "apartmentlocation";
$termchildren = get_term_children( $termID, $taxonomyName );
foreach ($termchildren as $child) {
$term = get_term_by( 'id', $child, $taxonomyName);
echo '<li><a href="' . get_term_link( $term->name, $taxonomyName ) . '">' . $term->name . '</a></li>';
}
Try
get_terms()instead, as it accepts a wider set of arguments.