Same name and namespace in other branches
  1. 4.6.x modules/taxonomy.module \taxonomy_del_vocabulary()
  2. 4.7.x modules/taxonomy.module \taxonomy_del_vocabulary()
  3. 5.x modules/taxonomy/taxonomy.module \taxonomy_del_vocabulary()

Delete a vocabulary.

Parameters

$vid: A vocabulary ID.

Return value

Constant indicating items were deleted.

2 calls to taxonomy_del_vocabulary()
forum_uninstall in modules/forum/forum.install
Implementation of hook_uninstall().
taxonomy_vocabulary_confirm_delete_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to delete a vocabulary after confirmation.

File

modules/taxonomy/taxonomy.module, line 237
Enables the organization of content into categories.

Code

function taxonomy_del_vocabulary($vid) {
  $vocabulary = (array) taxonomy_vocabulary_load($vid);
  db_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid);
  db_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid);
  $result = db_query('SELECT tid FROM {term_data} WHERE vid = %d', $vid);
  while ($term = db_fetch_object($result)) {
    taxonomy_del_term($term->tid);
  }
  module_invoke_all('taxonomy', 'delete', 'vocabulary', $vocabulary);
  cache_clear_all();
  return SAVED_DELETED;
}