Skip to content

Instantly share code, notes, and snippets.

@kitikonti
Created September 20, 2014 11:50
Show Gist options
  • Save kitikonti/6bda8d72ed0ac48a02e2 to your computer and use it in GitHub Desktop.
Save kitikonti/6bda8d72ed0ac48a02e2 to your computer and use it in GitHub Desktop.
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'taxonomy_term')
->entityCondition('bundle', 'property_country_city')
->fieldCondition('name_field', 'value', $city, '=')
->range(0, 1)
->addTag('term_is_child_of')
->addMetaData('parent_term_id', $country_id)
->addMetaData('account', user_load(1)); // Run the query as user 1.
$result = $query->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment