How do I access field variables directly in Drupal 7 without having to drill down into a node array?
There are two main methods:


Procedural, using field_get_items(), e.g.

$node = menu_get_object();
if ($items = field_get_items('node', $node, 'field_device_type_vocabulary')) {
  $tid = $items[0]['tid'];
}

Objected oriented, using an EntityMetadataWrapper, e.g.

$node = menu_get_object();
$wrapper = entity_metadata_wrapper('node', $node);
$tid = $wrapper-&gt;field_device_type_vocabulary[0]-&gt;tid-&gt;value();