cf_custom_fields_get_meta_data
Save form meta data.
Description
Returns (array)
Parameters (2)
- 0. $data
- The data.
- 1. $form
- The form.
Usage
if ( !function_exists( 'cf_custom_fields_get_meta_data' ) ) { require_once ABSPATH . PLUGINDIR . 'caldera-custom-fields/includes/metabox.php'; } // The data. $data = null; // The form. $form = null; // NOTICE! Understand what this does before running. $result = cf_custom_fields_get_meta_data($data, $form);
Defined (1)
The function is defined in the following location(s).
- /includes/metabox.php
- function cf_custom_fields_get_meta_data($data, $form) {
- global $post;
- $entry = array();
- foreach($form['fields'] as $fieldslug => $field ) {
- $data = get_post_meta( $post->ID, $field['slug'] );
- if( count( $data ) > 1 ) {
- foreach( $data as $item ) {
- $entry[$fieldslug][] = $item;
- }
- }else{
- if( is_array( $data ) && isset( $data[0] ) && is_scalar( $data[0] ) ) {
- $data = $data[0];
- }elseif( is_array( $data ) ) {
- $data = '';
- }
- $entry[$fieldslug] = $data;
- }
- }
- return $entry;
- }