Fetch third Level Depth Data from taxonomy with performance I have taxonomy with 4 Level State->District->Block->Villages. I want to get all villages of all Blocks of all Districts of a State.

I have done it by loops but my performance is very slow. please help me this take more time than expectation and very slow process.
You can fetch all child at any level by using this code :

function taxonomy_get_children_all($tid, $vid = 0, $key = 'tid'){
  $c = taxonomy_get_children($tid, $vid, $key);
  $result = array();
  foreach ($c as $t =&gt; $d){
    $result[$t] = $d;
    $below = taxonomy_get_children_all($t, $vid, $key);
    if (!empty($below)) {
      $result[$t]-&gt;children = array();
      foreach ($below as $nt =&gt; $nd){
        $result[$t]-&gt;children[$nt] = $nd;
      }
    }
  }
  return $result;
}


OR

You can do it by adding custom database query using function function taxonomy_get_children