I am writing a module that creates a vocabulary through code. Here's what I use:
$new_vocab_name = 'my_categories';
$vocab_obj = (object) array(
'name' => t('My Categories'),
'machine_name' => $new_vocab_name,
);
taxonomy_vocabulary_save($vocab_obj);
How do I add custom fields for terms that will be in this vocabulary? E.g., I want to add an image field for each term.