I’m registering taxonomy in my functions.php file:
register_taxonomy("our_gallery_types", array("gallery"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Category", "rewrite" => true));
And it works perfectly.
But I want also to automatically create two terms in this taxonomy, how would i do that?
When you run WordPress for the very first time and click Posts there is “Uncategorized” category. I want to do exactly the same for my taxonomy, so my users won’t get confused and won’t have to create categories for their own.
How do i achieve that?
use wp_insert_term() (after you register the taxonomy)
You can also check if a term exists() before doing that, to save some useless db queries…