I will explain my scenary and then my problema.. I have more than 10.000 products on my woocommerce categorized by differents name. IE car parts. I need yo create a new type of taxonomy that I will use Custom Post Type UI to create a new categorization in adittion the others.. that's looks good.. I have my 10.000 products categorized by car parts and my new taxonomy i.e. car brands.

My problem now is how can I modify all those 10.000 products at ones to get them into the right brand each one. So, is there a way to iterate the db and fill o edit that data to put them all at ones?


1 Answer 1


So! I solve this situation with: wp_set_post_terms.

I iterate my posts and for each one wp_set_post_terms make that part.

See here: https://developer.wordpress.org/reference/functions/wp_set_post_terms/

Now I have my categories from wp and my customs post with his own categories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.