Title: get_term_children order
Last modified: August 22, 2016

---

# get_term_children order

 *  Resolved [Nico Martin](https://wordpress.org/support/users/nico_martin/)
 * (@nico_martin)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/get_term_children-order/)
 * Hy is there a possibility to use the custom order for the get_term_children($
   parent_id,$tax) function?
 * [https://wordpress.org/plugins/taxonomy-terms-order/](https://wordpress.org/plugins/taxonomy-terms-order/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Pierre.Toulmonde](https://wordpress.org/support/users/pierretoulmonde/)
 * (@pierretoulmonde)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/get_term_children-order/#post-5578618)
 * Hi,
    nice plugin ! Got exactly the same problem though:(
 *  Plugin Author [nsp-code](https://wordpress.org/support/users/nsp-code/)
 * (@nsp-code)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/get_term_children-order/#post-5578621)
 * Hi
    Sorry for this functionality is currently available only for advanced version.
   However you can use get_terms instead then filter out the terms you don’t need
   to include.
 *  [Pierre.Toulmonde](https://wordpress.org/support/users/pierretoulmonde/)
 * (@pierretoulmonde)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/get_term_children-order/#post-5578624)
 * For Nico, I solved my problem using get_terms.
    My former code :
 *     ```
       $termID = $cat_id; // Parent A ID
         $taxonomyName = "event-category";
         $termchildren = get_term_children( $termID, $taxonomyName );
   
       foreach ($termchildren as $child) {
   
       $term = get_term_by( 'id', $child, $taxonomyName );
        $term_slug = $term->slug;
       $term_tax_id = $term->term_id;
   
       echo "<h2><a href='".get_term_link( $term )."'>".$term->name."</a></h2>";
   
         $events = eo_get_events(array(
                 'numberposts'=>-1,
                 'showpastevents'=>true,//Will be deprecated, but set it to true to play it safe.
       		  'event-category'=>$term_slug
            ));
   
       	 if($events):
                 echo '<ul>';
                 foreach ($events as $event):
       		  $custom_terms = get_terms('event-category');
   
                      //Check if all day, set format accordingly
                      $format = ( eo_is_all_day($event->ID) ? get_option('date_format') : get_option('date_format').' '.get_option('time_format') );
                      echo '<li>';
       			   echo '<a href="'.get_permalink($event->ID).'">'.get_the_title($event->ID).'</a> - '.eo_get_the_start($format, $event->ID,null,$event->occurrence_id);
       			   echo '</li>';
   
                 endforeach;
                 echo '</ul>';
       		 endif;
       ```
   
 * Corrected Code
 *     ```
       $termID = $cat_id; // Parent A ID
           $taxonomyName = "event-category";
           $termchildren = get_terms( $taxonomyName, array( 'child_of' => $termID, 'orderby'       =>  'term_order',
                       'hide_empty'    => false ) );
       //	get_term_children( $termID, $taxonomyName );
   
                 foreach ($termchildren as $child) {
       			  $term_slug = $child->slug;
       			  $term_tax_id = $child->term_id;
       			  $tag_desc = $child->description;
   
       echo "<h2><a href='".get_term_link( $child )."'>".$child->name."</a></h2>";
   
       						if ( ! empty( $tag_desc ) )
       							echo $tag_desc;
       ```
   
 *  Thread Starter [Nico Martin](https://wordpress.org/support/users/nico_martin/)
 * (@nico_martin)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/get_term_children-order/#post-5578629)
 * That works great! Thank you!!
    I only had to adjust my code because get_terms()
   returns the terms and get_term_children() returns the term IDs. But now its works!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘get_term_children order’ is closed to new replies.

 * ![](https://ps.w.org/taxonomy-terms-order/assets/icon-256x256.png?rev=1564412)
 * [Category Order and Taxonomy Terms Order](https://wordpress.org/plugins/taxonomy-terms-order/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/taxonomy-terms-order/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/taxonomy-terms-order/)
 * [Active Topics](https://wordpress.org/support/plugin/taxonomy-terms-order/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/taxonomy-terms-order/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/taxonomy-terms-order/reviews/)

## Tags

 * [Category Order and Taxonomy Terms Order](https://wordpress.org/support/topic-tag/category-order-and-taxonomy-terms-order/)
 * [get_term_children](https://wordpress.org/support/topic-tag/get_term_children/)
 * [order](https://wordpress.org/support/topic-tag/order/)

 * 4 replies
 * 3 participants
 * Last reply from: [Nico Martin](https://wordpress.org/support/users/nico_martin/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/get_term_children-order/#post-5578629)
 * Status: resolved