You are here

14 May 2011

How to add taxonomy terms programmatically in Drupal 7.

Source code viewer
  1. $taxonomy_terms_attributes = array(
  2. 'name' => 'term name',
  3. 'vid' => $vocabulary_id,
  4. 'vocabulary_machine_name' => 'vocabulary machine name'
  5. );
  6.  
  7. // in earlier Drupal versions use taxonomy_save_term
  8. taxonomy_term_save((object)$form_values);
Programming Language: PHP