Finding the vocabulary id in Drupal 7 with Drush

In Drupal 6 as you could go into the taxonomy section of the admin area and look at the vocabulary edit URL to find the numerical vocabulary id. In Drupal 7 the URL is no longer as verbose as it now shows the machine name of the vocabulary, for example admin/structure/taxonomy/my_vocabulary/edit.

If you have access to Drush, there is another way to quickly find the VID though:

drush php-eval '$tax=taxonomy_vocabulary_machine_name_load("main_site_structure"); echo $tax->vid;'
 

Comments

Jnsl's picture

Can't get this to work, damn

Can't get this to work, damn seems very handy though

admin's picture

Hi Jnsl, Just tested this on

Hi Jnsl,

Just tested this on another server / another D7 install (Drush version 4.4), works like a charm:

drush php-eval '$tax=taxonomy_vocabulary_machine_name_load("tags"); echo$tax->vid;'

where "tags" is the machine name.

Jnsl's picture

Ah ofc. I'm sleeping, missed

Ah ofc. I'm sleeping, missed the machine name hehe. Thanks for quick reply

Post new comment

2 + 14 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.