I am using wp_set_object_terms to add terms (attributes) to our WooCommerce products:
wp_set_object_terms($id, array($migrate_case), 'pa_case');
This gives us the advantage (instead of using wp_set_post_terms) that non-existing terms are created automatically.
Is there any way to get wp_set_object_terms() to tell me if it had to create a new term?
Thanks in advance for any help.
count()
, maybe. – Michael Oct 3 '18 at 20:40wp_set_object_terms
, and remove it right afterwards. At least that's what I usually do in similar situations. add_action remove_action. – Michael Oct 4 '18 at 18:58