2

I want to move a term from one vocabulary to another. In drupal 7 one can use taxonomy manager to do this but drupal 8 branch has not implemented MOVE yet and the module has not received any update in some time.

Taxonomy merge that is suggested in this thread has not even been ported in drupal 8 yet.

Thus the only way that is left to do such a task is programmatically.

How do you update programmatically the vocabulary or a term?

5

You should load existing term using term id and then update vid of term from new vocabulary vid then save it.


use Drupal\taxonomy\Entity\Term;

$term = Term::load($tid);
$term->vid->setValue('ID value');
$term->Save();

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.