Skip to main content
Added code markup
Source Link

You could wipe all terms from a product using the wp_set_post_terms function. Setting the append argument to false ensures that all terms are overwritten.

For example:

wp_set_post_terms( $product_id, array(), 'product_cat', false );

More information on the wp_set_post_termswp_set_post_terms function: https://developer.wordpress.org/reference/functions/wp_set_post_terms/

You could wipe all terms from a product using the wp_set_post_terms function. Setting the append argument to false ensures that all terms are overwritten.

For example:

wp_set_post_terms( $product_id, array(), 'product_cat', false );

More information on the wp_set_post_terms function: https://developer.wordpress.org/reference/functions/wp_set_post_terms/

You could wipe all terms from a product using the wp_set_post_terms function. Setting the append argument to false ensures that all terms are overwritten.

For example:

wp_set_post_terms( $product_id, array(), 'product_cat', false );

More information on the wp_set_post_terms function: https://developer.wordpress.org/reference/functions/wp_set_post_terms/

Source Link

You could wipe all terms from a product using the wp_set_post_terms function. Setting the append argument to false ensures that all terms are overwritten.

For example:

wp_set_post_terms( $product_id, array(), 'product_cat', false );

More information on the wp_set_post_terms function: https://developer.wordpress.org/reference/functions/wp_set_post_terms/