Set taxonomy option by code

You'll need to create a custom module and use the hook_form_alter() function.

function example_form_alter(&$form, $form_state, $form_id) {
  $form['taxonomy'][2]['#default_value'] = array(0 => $term->tid);
}

Please note that the $form['taxonomy'][2]['#default_value'] is the vocabulary id.

Category: 
Tags: 

Ivan is the founder of Web Wash and spends most of his time consulting and writing about Drupal. He's been working with Drupal for 6 years and has successfully completed several large Drupal projects in Australia.

Connect: Twitter drupal.org LinkedIn App.net