Drupal 8 Programmatically Create Taxonomy Term

[Solved] Drupal 8 Programmatically Create Taxonomy Term | Php Frameworks Drupal - Code Explorer | yomemimo.com
Question : drupal 8 programmatically create taxonomy term

Answered by : gleaming-gannet-htlwomz3dthc

$term_settings = [ 'name' => $name, 'vid' => $vocabulary, 'langcode' => $language,
];
$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term_settings);
// Or
$term = \Drupal\taxonomy\Entity\Term::create($term_settings);
// Save.
$term->save();

Source : | Last Update : Mon, 08 Aug 22

Answers related to drupal 8 programmatically create taxonomy term

Code Explorer Popular Question For Php Frameworks Drupal