تابع ووکامرسی wc_clear_term_product_ids پاکسازی term شناسه محصول

تابع ووکامرسی wc_clear_term_product_ids – پاکسازی و حذف term شناسه محصول
Syntax – سینتکس
wc_clear_term_product_ids( (int) $object_id, (array) $terms, (array) $tt_ids, (string) $taxonomy, (bool) $append, (array) $old_tt_ids );
Parameters – پارامتر ها (6)
- 1- $object_id (int)
- 2- $terms (array)
- 3- $tt_ids (array)
- 4- $taxonomy (string)
- 5- $append (bool)
- 6- $old_tt_ids (array)
Usage – نحوه استفاده
if ( !function_exists( 'wc_clear_term_product_ids' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-term-functions.php';
}
// The object id.
$object_id = -1;
// An array of object terms.
$terms = array();
// An array of term taxonomy IDs.
$tt_ids = array();
// Taxonomy slug.
$taxonomy = '';
// Whether to append new terms to the old terms.
$append = true;
// Old array of term taxonomy IDs.
$old_tt_ids = array();
// NOTICE! Understand what this does before running.
$result = wc_clear_term_product_ids($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids);
Defined – محل تعریف
/includes/wc-term-functions.php
function wc_clear_term_product_ids( $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids ) {
foreach ( $old_tt_ids as $term_id ) {
delete_woocommerce_term_meta( $term_id, 'product_ids' );
}
foreach ( $tt_ids as $term_id ) {
delete_woocommerce_term_meta( $term_id, 'product_ids' );
}
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر