تابع _wc_get_cached_product_terms دریافت مقدار های taxonomy بر اساس فیلد

تابع _wc_get_cached_product_terms دریافت مقدار های taxonomy بر اساس فیلد

تابع ووکامرسی _wc_get_cached_product_terms – دریافت مقدار های taxonomy بر اساس فیلد

Syntax – سینتکس

(array) _wc_get_cached_product_terms( (int) $product_id, (string) $taxonomy, (array) $args = array() ); 

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

  • 1- $product_id (int)
  • 2- $taxonomy (string)
  • 3- $args (array)

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

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

Defined – محل تعریف

/includes/wc-term-functions.php

function _wc_get_cached_product_terms( $product_id, $taxonomy, $args = array() ) { 
    $cache_key = 'wc_' . $taxonomy . md5( json_encode( $args ) ); 
    $terms = wp_cache_get( $product_id, $cache_key ); 
 
    if ( false !== $terms ) { 
        return $terms; 
    } 
 
    // @codingStandardsIgnoreStart 
    $terms = wp_get_post_terms( $product_id, $taxonomy, $args ); 
    // @codingStandardsIgnoreEnd 
 
    wp_cache_add( $product_id, $terms, $cache_key ); 
 
    return $terms; 
} 

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