_wc_get_cached_product_terms()
Cached version of wp_get_post_terms(). This is a private function (internal use ONLY).
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
Array
.
Usage
_wc_get_cached_product_terms( $product_id, $taxonomy, $args );
- $product_id(int) (required)
- Product ID.
- $taxonomy(string) (required)
- Taxonomy slug.
- $args(array)
- Query arguments.
Default: array()
Changelog
Since 3.0.0 | Introduced. |
_wc_get_cached_product_terms() wc get cached product terms code WC 8.6.1
function _wc_get_cached_product_terms( $product_id, $taxonomy, $args = array() ) { $cache_key = 'wc_' . $taxonomy . md5( wp_json_encode( $args ) ); $cache_group = WC_Cache_Helper::get_cache_prefix( 'product_' . $product_id ) . $product_id; $terms = wp_cache_get( $cache_key, $cache_group ); if ( false !== $terms ) { return $terms; } $terms = wp_get_post_terms( $product_id, $taxonomy, $args ); wp_cache_add( $cache_key, $terms, $cache_group ); return $terms; }