get_woocommerce_term_meta

WooCommerce Term Meta API.

Description

get_woocommerce_term_meta( (mixed) $term_id, (string) $key, (bool) $single = true ); 

WC tables for storing term meta are @deprecated from WordPress 4.4 since 4.4 has its own table. This function serves as a wrapper, using the new table if present, or falling back to the WC table.

Parameters (3)

0. $term_id (mixed)
The term id.
1. $key (string)
The key.
2. $single — Optional. (bool) => true
(default: true)

Usage

  1. if ( !function_exists( 'get_woocommerce_term_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-term-functions.php'; 
  3.  
  4. // The term id. 
  5. $term_id = null; 
  6.  
  7. // The key. 
  8. $key = ''; 
  9.  
  10. // (default: true) 
  11. $single = true; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = get_woocommerce_term_meta($term_id, $key, $single); 
  15.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-term-functions.php  
  1. function get_woocommerce_term_meta( $term_id, $key, $single = true ) { 
  2. return function_exists( 'get_term_meta' ) ? get_term_meta( $term_id, $key, $single ) : get_metadata( 'woocommerce_term', $term_id, $key, $single );