Taxonomy field in code I am working on a module that has an install file that creates a taxonomy with postal codes.
And then imports all contacts from a csv file.

Now i would like to add a field to my taxonomy (boolean).

How would i approach this?

Thanks in advance!
Create a vocabulary  with fields

taxonomy_vocabulary_save((object) array(
      'name' =&gt; 'Vocabulary Name',
      'machine_name' =&gt; 'vocabulary_machine_name',
    ));

// Create a field
 $field = array(
    'field_name' =&gt; 'field_your_field',
    'type' =&gt; 'text',
    'label' =&gt; 'your label'
  );
  field_create_field($field);

  // Attach the field to our taxonomy entity
  $instance = array(
      'field_name' =&gt; 'field_your_field',
      'entity_type' =&gt; 'taxonomy_term',
      'bundle' =&gt; 'vocabulary_machine_name',
      'label' =&gt; 'Label',
      'description' =&gt; 'Description',
      'required' =&gt; true,
      'widget' =&gt; array(
        'type' =&gt; 'text_textfield',

      )
  );
  field_create_instance($instance);


You can create terms like below :

 $term = new stdClass();
    $term-&gt;name = ‘Your Term name’;
    $term-&gt;vid = 'vocabulary id'; 
    $term-&gt;field_your_field[LANGUAGE_NONE][0]['value'] = ‘data’; 
    taxonomy_term_save($term);