I am creating content type programmatically. I am importing content from csv file.. Everything working fine. But I am not able to select category at the time of import like other fields.. and how to convert term name to term id ,because csv giving me term name.

1 Answer 1


This function will return the term object if you pass it the term name: https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/function/taxonomy_get_term_by_name/7

There is an example at the bottom of that link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.