I can see in the Drupal taxonomy api taxonomy_get_tree() which returns an array of term objects, however, the vocabulary ID is a required object. I thought also about taxonomy_term_load_multiple, but an array of IDs is necessary to populate it.

How can I get all the objects regardless of vocabulary affiliation? More or less what I am looking for is taxonomy_get_tree('all').

Each term object contains the [vid] it's associated with. I need to be able to loop through each object and determine the vocabulary it's associated with rather than the other way around.

1 Answer 1


You can use the entity_load() function. The second argument, $ids, is defined as such:

An array of entity IDs, or FALSE to load all entities.

So you can get all taxonomy terms in the database with this simple call:

$all_terms = entity_load('taxonomy_term', FALSE);
  • Thanks for that. Looks like being more familiar with entities will save me a lot of work. Where can I get a list of the default entity types? I didn't have much luck with google other than how to create new ones. Thanks again!
    – blue928
    Sep 21, 2012 at 17:57
  • Basically any module that provides an entity has to implement hook_entity_info(), so that's the place to look in any specific module. There's a list of all core implementations of that hook here, if you look through those functions and read the hook_entity_info() docs it should all make sense :)
    – Clive
    Sep 21, 2012 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.