Search code examples
drupaldrupal-6drupal-taxonomy

Drupal6 - Getting term id from term name


Hi
Suppose I have a term name called "product" and the term id is "123", how can I use the term name "product" to get the term id "123"?

Thanks


Solution

  • $get_term = taxonomy_get_term_by_name('product');
    
    $term_id = $get_term[0]->tid;
    

    This should work for you.