UPDATE: I see that most likely the best way to accomplish this is to grab the term id from $content['field_tags']. However I'm not sure how to do that. Whenever I retrieve $content['field_tags'][value] all that gets returned is an array object. And when I attempt to render it all I get is the tag name.
I'm attempting to grab the taxonomy term id in the node template for a content type. I'm grabbing the taxonomy term by referencing the field that contains the taxonomy terms. Like so
$tag = render($content['field_tags'][$i]);
I then use taxonomy_get_term_by_name in order to grab the id for that term like so.
$term_array = taxonomy_get_term_by_name(render($content['field_tags'][$j])); $term = reset($term_array); $term_id = $term->tid;
It works like a charm except for one issue. I have a taxonomy category for tags as well as events, and when there is a term with the same name in both the 'event' and 'tags' category it grabs the event term id instead of from the 'tags' category, which I want.
Is there another way to grab the specific term id for the tag field? Would it be possible to grab the term id directly from this object?