WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Am hoping someone can help me pull out a single custom category name and show it on my custom post page. I've created a new custom post type 'Itinerary' as well as some new custom categories (terms):


  • Water Sports
  • Hiking Adventures
  • Mountain Biking ...


  • Australia
  • Canada
  • South America ...

Each Itinerary has 2 categories applied to it, for example: Itinerary 'Coastal Walks' is categorised as Hiking Adventures and Australia.

I would like to display in my single itinerary page the name of the child Destination e.g. Region: Australia (or whatever child destination is selected)

I've tried using this:

<?php echo the_terms( $post->ID, 'trip_cat', 'Region: ', ', ', ' ' );   ?>

but this displays all the categories selected - I'm trying to display only the child of category Destinations.

Can anyone please help? :)

share|improve this question

You can use get_term_children function.

For Example:

$termID = 10;
$taxonomyName = "region";
$termchildren = get_term_children( $termID, $taxonomyName );

echo '<ul>';
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>';
echo '</ul>';
share|improve this answer
Thanks for your help! I can get this function working, but it displays all regions in a list e.g. Australia Canada South America ... I need the function to somewhow reference the single page, check what location is selected e.g. Australia, and show only that destination. – Emj Ray Mar 13 '13 at 0:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.