Computed field - count number of taxonomy terms in term reference field So I simply want to count the number of tags on a term reference field.. I've tried a count (below) and it simply returns "1" (there are a lot more terms tagged than 1):

$entity_field[0]['value'] = count($entity-&gt;field_termref);


Also something like below does not work either and also returns "1" - I'm thinking I have to loop through the multiple tags somehow but I'm not sure how to do it. Thanks a lot for any help.

$myterms = array();
foreach($entity-&gt;field_guests as $tmp) {
  $myterms[] = $tmp_field_term;
}
$entity_field[0]['value'] = count($myterms);
Your first code was correct as far as it went: count($entity-&gt;field_termref) will return a count of one because the array has only one item, the list of terms.

To count the members of the list your will need to drop down into the array to actually count the list:

$entity_field[0]['value'] = count($entity-&gt;field_termref[LANGUAGE_NONE]);


The members of the list can then be counted:

$entity-&gt;field_termref[LANGUAGE_NONE][0]
$entity-&gt;field_termref[LANGUAGE_NONE][1]
$entity-&gt;field_termref[LANGUAGE_NONE][2]
...etc