How to get taxonomy term by description, programatically In a D7 custom module, I wish to retrieve a taxonomy term by it's description (and not it's name or TID). 

Right now I do have it working, but I feel the code is a bit clunky, and I feel like there is a more elegant / Drupally way of doing it.

Is there a better way of doing it then this?

$vocabulary = taxonomy_vocabulary_machine_name_load('my_vocabulary');
$terms = entity_load('taxonomy_term', FALSE, array('vid' =&gt; $vocabulary-&gt;vid));

foreach ($terms as $term) {
  if ($term-&gt;description == 'my_term_description') {
    // Do stuff when there is a match.
  }
}


Ideally, I feel like there is a better way I cannot find through Google / Drupal API etc. Something like:

$term = taxonomy_by_description_load('my_vocabulary', 'my_term_description');


Thanks everyone.
Using the EntityFieldQuery (this is untested)

  $query = new EntityFieldQuery();
  $query-&gt;entityCondition('entity_type', 'taxonomy_term')
    -&gt;entityCondition('bundle', array('my_vocabulary'))
    -&gt;propertyCondition('description', 'my_term_description');
  $result = $query-&gt;execute();
  $tids = array_keys($result['taxonomy_term']);

  return $tids;


More information https://www.drupal.org/docs/7/creating-custom-modules/howtos/how-to-use-entityfieldquery-for-drupal-7