I need to programmatically create a list of the tags used in a Drupal 7 website. I'm browsing through the api/functions, but can't find something like "get_list_of_terms()" :-)
How should I proceed? Thanks! J.
Exactly. A slightly more complete example is (you can substitute with your own vocabulary vid):
if ($terms = taxonomy_get_tree($vocabulary->vid)) {
foreach ($terms as $term) {
// Do something with $term->tid or $term->name
}
}
To get a list of taxonomy terms for a particular vocabulary, you could use taxonomy_get_tree
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With