wc_flatten_meta_callback

Callback which can flatten post meta (gets the first value if it's an array).

Description

wc_flatten_meta_callback( (array) $value ); 

Parameters (1)

0. $value (array)
The value.

Usage

  1. if ( !function_exists( 'wc_flatten_meta_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4. // The value. 
  5. $value = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_flatten_meta_callback($value); 
  9.  

Defined (1)

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

/includes/wc-formatting-functions.php  
  1. function wc_flatten_meta_callback( $value ) { 
  2. return is_array( $value ) ? current( $value ) : $value;