Getting a Node's Taxonomy Terms in Drupal 7
If you want to get the taxonomy terms to which a node belongs to in Drupal 6, there's a very convenient function, taxonomy_node_get_terms($nid).
On this new Drupal 7 site that I was working on, I discovered that handy little function no longer exists in the D7 codebase.
Huh? How are we supposed to get the terms for a node in Drupal 7 without doing a direct database query?
field_view_field($entity_type, $entity, $field_name)
My first thought was that the function must have morphed into a different function name. Grepping thru the taxonomy module, I couldn't find any functions that took $nid as a parameter. Maybe it got moved to the node module? I couldn't find any node_term* or node_taxonomy.* type function calls that took a $nid or $node as a parameter either.
It turns out that taxonomy terms have evolved into a field in in Drupal 7, so you'll need to use the field api's to access the terms to which a node belongs. Here's the secret sauce to find the taxonomy terms for a given $nid: