How to set default value for taxonomy autocomplete field? I am using Drupal 7. I have created a content type with autocomplete taxonomy field. I need to set default value programmatically.
I am using this code under hook_form_alter:

$form['field_school_locality_city_level'][LANGUAGE_NONE]['names']['#default_value'] = tid;


It's giving me just term id, but I need it in format Bhopal[tid:8193].
Load taxonomy term using term id then, generate data in your required format.

 // Term id.
 $tid = 8193;   
 // Obtain the term. 
 $term = taxonomy_term_load($tid);
 // Format data.
 $data = $term-&gt;name . '[tid:' . $tid .']';

$form['field_school_locality_city_level'][LANGUAGE_NONE]['names']['#default_value'] = $data;