php – How do I unset category from a product in wordpress by code

Question

I would like to take it out a category from a product. If I want to insert a category I use:

$categories = array(1, 2, 3); // Categories IDs
wp_set_post_terms($product->ID, $categories, 'product_cat', true);

However I do not know how to unset a category from the product. Someone can help me?

0
Rodrigo Franco 2 months 2022-12-23T22:38:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse