I figured out a way, although it feels a bit wrong.
First test if the taxonomy exists (which it doesn’t… the first time at least), and then create it as part of the process…
if (! taxonomy_exists($this->taxonomy_manufacturer)) {
register_taxonomy($this->taxonomy_manufacturer, 'product');
}
if (! term_exists($manufacturer['name'], $this->taxonomy_manufacturer)) {
wp_insert_term($manufacturer['name'], $this->taxonomy_manufacturer);
}
Caveat, register_taxonomy warns of impending doom if it’s called outside of init
. I’m not sure of the implications of it in my scenario, and I’ll report back if my spideysense starts tingling, but so far so good.