taxonomy_get_term_by_name

Versions
4.6 – 7
taxonomy_get_term_by_name($name)

Try to map a string to an existing term, as for glossary use.

Provides a case-insensitive and trimmed mapping, to maximize the likelihood of a successful match.

Parameters

name Name of the term to search for.

Return value

An array of matching term objects.

Code

modules/taxonomy.module, line 717

<?php
function taxonomy_get_term_by_name($name) {
  $db_result = db_query("SELECT * FROM {term_data} WHERE LOWER('%s') LIKE LOWER(name)", trim($name));
  $result = array();
  while ($term = db_fetch_object($db_result)) {
    $result[] = $term;
  }

  return $result;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.