You are here

8 September 2011

How to get vid - vocabulary id by vocabulary name in Drupal 6. You can get it by using this little function.

Source code viewer
  1. function my_module_get_vid_by_name($vocabulary_name) // don't froget to replace my_module with your modules machine name
  2. {
  3. $vocabs = taxonomy_get_vocabularies();
  4. foreach ($vocabs as $vocab_object)
  5. {
  6. if($vocab_object->name == $vocabulary_name)
  7. {
  8. return $vocab_object->vid;
  9. }
  10. }
  11. return FALSE;
  12. }
Programming Language: PHP