How to get nodes with term programmatically I have Vocabulary and Custom Content Type which has field Term reference.

How can I get all nodes of particular term in my module?

Something like this? This doesn't work.

$field = field_info_field('field_game');
$results = new EntityFieldQuery;
$results-&gt;fieldCondition($field, 'field_game_tid', '5')
  -&gt;execute();

$nids = array();
foreach($results as $result) {
  $nids[] = $result-&gt;nid;
}

$nodes = node_load_multiple($nids);
You want to specify that you searching for nodes first (and optionally by your content type), and then filter by term:

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'node')
-&gt;entityCondition('bundle', 'YOUR_CONTENT_TYPE_HERE')
-&gt;fieldCondition('field_game', 'tid', 5);

$result = $query-&gt;execute();
$nids = array_keys($result['node']);
$nodes = entity_load('node', $nids);


Here's a good example of an entity query like this (and more field conditions)