I am wondering how to retrieve the actual data of a field instead of the tid on a node. Googling around I found a solution to a similar problem, by constructing a query on my own. However, it is usually the case that a function already exists for this. Do you know how I can achieve this?

What I get is something like this

field_category (Array, 1 element)
  -> und (Array, 1 element)
    -> 0 (Array, 1 element)
      -> tid (String, 2 characters ) 18

Specifically for taxonomy terms you have taxonomy_term_load(), e.g.

if ($field_items = field_get_items('node', $node, 'field_category')) {
  $tid = $field_items[0]['tid'];
  $term = taxonomy_term_load($tid);
  • 1
    I've also found quite useful the field_view_field('node', $node, 'field_category'); – Potney Switters Jul 31 '13 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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