Welcome to Findnerd. We all knows we can build our own custom taxonomies and insert the terms in taxonomies. There is one function available to insert the terms in perticular taxonomy named wp_insert_terms which takes three parameters. First one is name of the term. You can simply build an array of different terms and set as first parameter in the function and second parameter will take name of the taxonomy for which you are going to add the terms. Third one is the array of the aguments which takes different arguments such as slug,description,parent,alias_of. Let's take an simple example.
$parent_term_id = 34; // get numeric term id
wp_insert_term(
'Casey', // the term
'product', // the taxonomy
array(
'description'=> 'new player.',
'slug' => 'casey',
'parent'=> $parent_term_id
)
);
In above example we build a term named casey which is a player name and also set the parent term.
0 Comment(s)