List parent terms by vocabulary I want to list only parent terms in order to rearrange the orders like /admin/structure/taxonomy/vocabulary_name. Given url have displayed all terms included child terms. I want to avoid term terms. So i've tried to create custom page.
I've tried below code but i can't make it work.

function test_menu() {
  $items['manage_category/%taxonomy_vocabulary_machine_name'] = array(
   'title' =&gt; t('Manage category'),
   'page callback' =&gt; 'arep_manage_category',
   'page arguments' =&gt; array(1),
   'access arguments' =&gt; array('administer taxonomy'),
   'type' =&gt; MENU_CALLBACK,
 );
 return $items;
}

function arep_manage_category() {
  $category = arg(1);
  module_load_include('inc', 'taxonomy', 'taxonomy.admin');
  $taxonomy = taxonomy_vocabulary_machine_name_load($category);
  $form = drupal_get_form('taxonomy_overview_terms', 'taxonomy_term', $taxonomy);
  return drupal_render($form);
}


I've tried to access this page by vocabulary name. How ot make it work? Is any other idea?
Firstly you add a cck field named flag for levels to your vocabulary when created, then after that when you import or add terms in this then fill flag value like "My First Level"/"My Second Level". then you can fetch very easily like that..`

/* Get All States From Taxonomies */
  function get_taxonomy_by_flag($flag) {
       $VocabName = "Master Data";
          $myStateArray = array(0=&gt;'-- Select --');
        $Vocabluary = get_vocabulary_by_name($VocabName);
         $query = new EntityFieldQuery();
          $entities = $query-&gt;entityCondition('entity_type', 'taxonomy_term')
-&gt;propertyCondition('vid', $Vocabluary-&gt;vid)    
-&gt;fieldCondition('field_flag', 'value', $flag, '=')    
-&gt;execute();
if(sizeof($entities)&gt;0)
{       
  foreach($entities['taxonomy_term'] as $tid) {

    $term = taxonomy_term_load($tid-&gt;tid);     
    $name=$term-&gt;name;
    $myStateArray[$term-&gt;field_code['und']['0']['value']] = $name;    
  }   
  return $myStateArray;     
}
else
{
    return 0;
 }    
}

    function get_vocabulary_by_name($vocabulary_name) {
        $vocabs = taxonomy_get_vocabularies(NULL);
         foreach ($vocabs as $vocab_object) {
          if ($vocab_object-&gt;name == $vocabulary_name) {
            return $vocab_object;
         }
      }
            return NULL;
      }
     call this function by flag name and you can easily get all parents. because i have used this for **State/District/Block/Village** purpose.
      get_taxonomy_by_flag('STATE');


hope this helps you lot...