wc_clear_term_product_ids()
When a post is updated and terms recounted (called by _update_post_term_count), clear the ids.
No Hooks.
Returns
null. Nothing (null).
Usage
wc_clear_term_product_ids( $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
- $object_id(int) (required)
- Object ID.
- $terms(array) (required)
- An array of object terms.
- $tt_ids(array) (required)
- An array of term taxonomy IDs.
- $taxonomy(string) (required)
- Taxonomy slug.
- $append(true|false) (required)
- Whether to append new terms to the old terms.
- $old_tt_ids(array) (required)
- Old array of term taxonomy IDs.
wc_clear_term_product_ids() wc clear term product ids code WC 10.6.2
function wc_clear_term_product_ids( $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ) {
foreach ( $old_tt_ids as $term_id ) {
delete_term_meta( $term_id, 'product_ids' );
}
foreach ( $tt_ids as $term_id ) {
delete_term_meta( $term_id, 'product_ids' );
}
}