Reputation: 995
How to get machine name of taxonomy term in code having taxonomy term ID in Drupal 7?
I tried taxonomy_term_load() , but it doesn't return machine name.
Thanks.
Upvotes: 2
Views: 5850
Reputation: 369
Natively taxonomy term doesn't support machine name such as vocabulary. I have just developped a module to support a such feature. It alters taxonomy term properties by addind a new field named "machine_name" which can be typed or automatically generated using the term name.
https://www.drupal.org/project/taxonomy_machine_name
Hope it helps you or someone else.
BR
Upvotes: 3
Reputation: 995
Ok, this path is generated by Drupal core module "path" and I solved in following way.
$out_alias = drupal_lookup_path('alias', 'taxonomy/term/3');
The second option could be:
$out_alias = url('taxonomy/term/3');
Thanks for your time.
Upvotes: 2
Reputation: 27053
Use pathauto's
pathauto_cleanstring() function to clean up the string of your taxonomy term.
Upvotes: 4