تابع ووکامرسی wc_get_product_term_ids دریافت ترم آیدی برای تاکسونومی

تابع ووکامرسی wc_get_product_term_ids دریافت ترم آیدی برای تاکسونومی

تابع ووکامرسی wc_get_product_term_ids – دریافت ترم آیدی برای تاکسونومی

Syntax – سینتکس

(array) wc_get_product_term_ids( (int) $product_id, (string) $taxonomy ); 

Parameters – پارامتر ها (2)

  • 1- $product_id (int)
  • 2- $taxonomy (string)

Usage – نحوه استفاده

if ( !function_exists( 'wc_get_product_term_ids' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-product-functions.php'; 
} 
  
// The product id. 
$product_id = -1; 
  
// Taxonomy slug. 
$taxonomy = ''; 
  
// NOTICE! Understand what this does before running. 
$result = wc_get_product_term_ids($product_id, $taxonomy); 
    

Defined – محل تعریف

/includes/wc-product-functions.php

function wc_get_product_term_ids( $product_id, $taxonomy ) { 
    $terms = get_the_terms( $product_id, $taxonomy ); 
    return ! empty( $terms ) ? wp_list_pluck( $terms, 'term_id' ) : array(); 
} 

versions – نسخه ها

از نسخه : 3.0.0

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us