how to add taxonomy terms to admin/config/people/accounts/fields programmatically? I know I can use the UI at admin/config/people/accounts/fields to add existing taxonomy fields.

But I want to create them automatically using my module.

I know I can use hook_enable() or hook_install() for this but I don't know which hook or function I need to use to make the field show up in admin/config/people/accounts/fields ( and on the user edit / registration page )

I've read somewhere something about a bundle but I'm not sure if I'm looking in the right direction there.
You need to create an instance of the field, and then attach it to your content type. This is done using the field_create_instance() function.

There's a nice example in the standard profile of attaching the 'Tags' vocabulary to the article content type upon install:

$instance = array(
  'field_name' =&gt; 'field_' . $vocabulary-&gt;machine_name,
  'entity_type' =&gt; 'node',
  'label' =&gt; 'Tags',
  'bundle' =&gt; 'article',
  'description' =&gt; $vocabulary-&gt;help,
  'widget' =&gt; array(
    'type' =&gt; 'taxonomy_autocomplete',
    'weight' =&gt; -4,
  ),
  'display' =&gt; array(
    'default' =&gt; array(
      'type' =&gt; 'taxonomy_term_reference_link',
      'weight' =&gt; 10,
    ),
    'teaser' =&gt; array(
      'type' =&gt; 'taxonomy_term_reference_link',
      'weight' =&gt; 10,
    ),
  ),
);
field_create_instance($instance);


The documentation page has a full list of all the available properties for your field instance, but the above code is an excellent place to start.

I also have this piece of code in my arsenal which dumps the field/instance definitions of an existing field so I can inspect it and just chop and change what I need to:

$entity_type = 'node';
$field_name = 'field_FIELDNAME';
$bundle_name = 'BUNDLE_NAME';

$info_config = field_info_field($field_name);
$info_instance = field_info_instance($entity_type, $field_name, $bundle_name);
unset($info_config['id']);
unset($info_instance['id'], $info_instance['field_id']);
include_once DRUPAL_ROOT . '/includes/utility.inc';
$output = "field_create_field(" . drupal_var_export($info_config) . ");\n";
$output .= "field_create_instance(" . drupal_var_export($info_instance) . ");";
drupal_set_message("&lt;textarea rows=30 style=\"width: 100%;\"&gt;". $output .'&lt;/textarea&gt;');