-
-
Save jonathanpglick/3751195 to your computer and use it in GitHub Desktop.
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
<?php | |
$market_vocab = taxonomy_vocabulary_machine_name_load('markets'); | |
$terms = array( | |
'Housing' => array( | |
'Affordable', | |
'Apartments', | |
'Condos', | |
'Student', | |
'Senior', | |
), | |
); | |
foreach ($terms as $term_name => $term_children) { | |
$term = new stdClass; | |
$term->vid = $market_vocab->vid; | |
$term->name = $term_name; | |
$term->description = _get_term_lipsum(); | |
$parent_tid = taxonomy_term_save($term); | |
foreach ($term_children as $term_child_name) { | |
$term = new stdClass; | |
$term->vid = $market_vocab->vid; | |
$term->name = $term_child_name; | |
$term->description = _get_term_lipsum(); | |
$term->parent = $parent_tid; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment