Create a vocabulary taxonomy programmatically

This is how you can create a vocabulary in your code.

<?php
function _create_vocabulary() {
   
 
$vocabulary = array(
   
'name' => t('Finance products'),
   
'multiple' => 0,
   
'required' => 0,
   
'hierarchy' => 1,
   
'relations' => 0,
   
'module' => 'Finance',
   
'weight' => -10,
   
'nodes' => array('client' => 1),
  );

 
taxonomy_save_vocabulary($vocabulary);
}
?>



Array (
'vid' => int -- ID for updating the vocabulary.
'name' => String -- Vocabulary name: The name for this vocabulary. Example: "Topic".
'multiple' => (0/1) -- Allows nodes to have more than one term from this vocabulary (always true for free tagging).
*'description' = String – Description of the vocabulary; can be used by modules.
*'help' = String – Instructions to present to the user when choosing a term.
'required' => (0/1) -- If enabled, every node must have at least one term in this vocabulary.
'hierarchy' => (0/1) -- Allows a tree-like hierarchy between terms of this vocabulary.
'relations' => (0/1) – Allows related terms in this vocabulary.
*'tags' => (0/1) – Content is categorized by typing terms instead of choosing from a list.
*'weight' = number (-10 <-> 10) the displayed weight of the taxonomy. In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.
'module' => String – Name of module the Vocabulary is used
'nodes' => Array ("nodetype" => (0/1) disabled or active in the node) A list of node types you want to associate with this vocabulary.
Knowledge keywords: