تابع ووکامرسی wc_get_term_product_ids نمایش آیدی محصولات با آیدی ترم

تابع ووکامرسی wc_get_term_product_ids – نمایش آیدی محصولات با آیدی ترم محصول
Syntax – سینتکس
(array) wc_get_term_product_ids( (int) $term_id, (string) $taxonomy );
Parameters – پارامتر ها (2)
- 1- $term_id (int)
- 2- $taxonomy (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_term_product_ids' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-term-functions.php';
}
// The term id.
$term_id = -1;
// The taxonomy.
$taxonomy = '';
// NOTICE! Understand what this does before running.
$result = wc_get_term_product_ids($term_id, $taxonomy);
Defined – محل تعریف
/includes/wc-term-functions.php
function wc_get_term_product_ids( $term_id, $taxonomy ) {
$product_ids = get_woocommerce_term_meta( $term_id, 'product_ids', true );
if ( false === $product_ids || ! is_array( $product_ids ) ) {
$product_ids = get_objects_in_term( $term_id, $taxonomy );
update_woocommerce_term_meta( $term_id, 'product_ids', $product_ids );
}
return $product_ids;
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر