I am attempting to create section of my website footer that has link li of terms from a parent for a custom taxonomy I created.

function add_custom_taxonomies() {
  // Add new "producttype" taxonomy to products
  register_taxonomy('producttype', 'product', array(
    // Hierarchical taxonomy (like categories)
    'hierarchical' => true,
    // This array of options controls the labels displayed in the WordPress Admin UI
    'labels' => array(
      'name' => _x( 'Producttypes', 'taxonomy general name' ),
      'singular_name' => _x( 'Producttype', 'taxonomy singular name' ),
      'search_items' =>  __( 'Search Producttypes' ),
      'all_items' => __( 'All Producttypes' ),
      'parent_item' => __( 'Parent Producttype' ),
      'parent_item_colon' => __( 'Parent Producttype:' ),
      'edit_item' => __( 'Edit Producttype' ),
      'update_item' => __( 'Update Producttype' ),
      'add_new_item' => __( 'Add New Producttype' ),
      'new_item_name' => __( 'New Producttype Name' ),
      'menu_name' => __( 'Product Type' ),
    // Control the slugs used for this taxonomy
    'rewrite' => array(
      'slug' => 'Producttype', // This controls the base slug that will display before each term
      'with_front' => false, // Don't display the category base before "/locations/"
      'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
add_action( 'init', 'add_custom_taxonomies', 0 );

I have a parent that i created for the taxonomy "producttype" called "Type" I would like to get only those child terms under the parent term "Type" and display them as a link. I created the parent term in the wordpress dashboard manually.


get_term_children() should be able to do just that. The example in the link looks good.

  • Hello @Taruckus thank you for your reply, I have attempter to use the get_ter_children() like so <?php $terms= get_term_children( 'Type', 'producttype' ); echo $terms; ?> but it does seem to be working any idea why? thank you. – steamfunk Feb 14 '15 at 0:52
  • @steamfunk The first argument needs to be the term ID, not the name or slug. – TheDeadMedic Feb 14 '15 at 13:17
  • @TheDeadMedic the 'Type' is the Term iD i need the children of to be displayed. I created the parent in my dashboard manually. and the 'Producttype' is the custom taxonomy i created for a custom post type called 'product' – steamfunk Feb 14 '15 at 18:45
  • So wait, that was just an example? Or are you actually using 'Type' as the first argument? – TheDeadMedic Feb 14 '15 at 20:53
  • 1
    Yes, so you need to use the ID, not the name. – TheDeadMedic Feb 16 '15 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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