Sort taxonomy terms alphabetically by default I created a taxonomy vocabulary and added some taxonomy terms to it. How can i sort alphabetically the listing of terms in taxonomy vocabulary page. The same sorting needs to reflect in content type fields when this vocabulary is added as term reference.
I hijacked the code from /modules/taxonomy/taxonomy.admin.inc that runs when you click "Reset to alphabetical". I tweaked it a bit and you can place this code in a custom module and it will run every time you insert a taxonomy term.

/**
 * Implements hook_taxonomy_term_insert()
 */
function YOURMODULE_taxonomy_term_insert($term) {

  $vocabulary = taxonomy_vocabulary_load($term-&gt;vid);
  $tree = taxonomy_get_tree($vocabulary-&gt;vid);

  if($vocabulary-&gt;machine_name = 'MACHINE_NAME_YOU_WANT_TO_FORCE_ORDERING') {
    //Make sure the taxonomy doesn't have terms with two parents
    if ($vocabulary-&gt;hierarchy &lt; 2 &amp;&amp; count($tree) &gt; 1) {
      $params = array(
        'values' =&gt; array(
          'vid' =&gt; $term-&gt;vid, 
          'name' =&gt; $vocabulary-&gt;name, 
          'machine_name' =&gt; $vocabulary-&gt;machine_name, 
        ), 
      );

      taxonomy_vocabulary_confirm_reset_alphabetical_submit(NULL, $params);
    }
  }
}


If you want it to apply to all vocabularies, you can remove the IF statement on line 7. Good luck!