Skip to content

Instantly share code, notes, and snippets.

@dreambubbler
Last active April 6, 2020 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dreambubbler/f671351e102e6c829b13dbcef37fad62 to your computer and use it in GitHub Desktop.
Save dreambubbler/f671351e102e6c829b13dbcef37fad62 to your computer and use it in GitHub Desktop.
Drupal 8 Create Taxonomy Term programmatically
$new_term = \Drupal\taxonomy\Entity\Term::create([
'vid' => 'example_vocabulary_machine_name',
'name' => 'Example term name',
]);
$new_term->enforceIsNew();
$new_term->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment