0

I have a vocab like 'category'. I want to add terms under this dynamically i.e when a content of type 'category_list' is added a term with this content title should be added under the 'category' vocab. Can this be done?

1

In short, "yes".

Using hook_node_insert() where you can assign a category term value programmatically. Note that this is an over-ride (hook) of the node creation process. Basically do a Googe search for Drupal 7 node creation programmatically", example: Guide to programmatic node creation in Drupal 7. Look for the details on "Term reference (taxonomy) field".

Note that this an advanced Drupal task that involves creating a custom module that's specific to your site. If you're not already familiar with this process of applying hook functions to alter default Drupal functionality then I suggest you do some research on basic Drupal requirements for custom module creation first.

Good luck and keep asking questions, you'll figure it out and might become a Drupal rock star in the process!

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.