cf_custom_fields_get_meta_data

Save form meta data.

Description

(array) cf_custom_fields_get_meta_data( $data, $form ); 

Returns (array)

Parameters (2)

0. $data
The data.
1. $form
The form.

Usage

  1. if ( !function_exists( 'cf_custom_fields_get_meta_data' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-custom-fields/includes/metabox.php'; 
  3.  
  4. // The data. 
  5. $data = null; 
  6.  
  7. // The form. 
  8. $form = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cf_custom_fields_get_meta_data($data, $form); 
  12.  

Defined (1)

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

/includes/metabox.php  
  1. function cf_custom_fields_get_meta_data($data, $form) { 
  2. global $post; 
  3. $entry = array(); 
  4. foreach($form['fields'] as $fieldslug => $field ) { 
  5. $data = get_post_meta( $post->ID, $field['slug'] ); 
  6. if( count( $data ) > 1 ) { 
  7. foreach( $data as $item ) { 
  8. $entry[$fieldslug][] = $item; 
  9. }else{ 
  10.  
  11. if( is_array( $data ) && isset( $data[0] ) && is_scalar( $data[0] ) ) { 
  12. $data = $data[0]; 
  13. }elseif( is_array( $data ) ) { 
  14. $data = ''; 
  15.  
  16. $entry[$fieldslug] = $data; 
  17.  
  18. return $entry;