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?

2 Answers 2

7

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();

0
0

https://www.drupal.org/project/term_manager

You can use Term Manager to move Term to new Vocabulary

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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