Last active
April 6, 2020 22:50
-
-
Save dreambubbler/f671351e102e6c829b13dbcef37fad62 to your computer and use it in GitHub Desktop.
Drupal 8 Create Taxonomy Term programmatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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