Create a vocabulary with terms that are linked to a content type
When you are creating a new node, you call taxonomy_term_save(), passing as argument the taxonomy term object $term, and using the node title for set $term-&gt;name, and the vocabulary ID to set $term-&gt;vid.
When you update a node, you first you load the taxonomy term with taxonomy_term_load_multiple(), as in taxonomy_term_load_multiple(array(), array('name' =&gt; trim($name), 'vid' =&gt; $vid)), change $term-&gt;name, and save the taxonomy term with taxonomy_term_save().
When you delete a node, you first load the taxonomy term with taxonomy_term_load_multiple(array(), array('name' =&gt; trim($name), 'vid' =&gt; $vid)), and then delete it passing $term-&gt;tid to taxonomy_term_delete().


The functions I reported needs to use the vocabulary ID; this means that the module you are writing needs to save in a Drupal variable the ID of the vocabulary it created, or to ask to the user the vocabulary name for the vocabulary that needs to be used. In the second case, and in the case the module stores the vocabulary name, code similar to the following one should be used to get the vocabulary ID:

$vocabulary = taxonomy_vocabulary_load_multiple(array(), array('name' =&gt; trim($name)));
$vocabulary = reset($vocabulary);
$vid = $vocabulary-&gt;vid;


The code needs to be changed for Drupal 8, as the conditions (the second parameter of taxonomy_term_load_multiple(), and taxonomy_vocabulary_load_multiple()) will be removed in Drupal 8.