Thanks for your response,
So i asked for help from Plugin developer and provided a code sample which was used for Gravity form's checkboxes values to convert as serialized array, So he wrote down a code but that's not working and I may need your help to make it work. I am really in trouble if it doesn't work. So Please assist me somehow. Below is the code given by the plugin developer.
function f4d_convert_metadata( $attr ) {
// CHANGE THIS LIST TO ANY META DATA YOU NEED TO CONVERT
$meta_keys = array( 'form_meta_key1', 'form_meta_key2', 'form_meta_key3' );
// DO NOT CHANGE BELOW CODE
$post_id = $attr['post_id'];
foreach($meta_keys as $meta_key){
// Grab meta value
$meta_value = get_post_meta( $post_id, $meta_key, true );
// Convert to Array
$meta_value = explode(',', $meta_value);
// Save it as array
update_post_meta( $post_id, $meta_key, $meta_value );
}
}
add_action('super_front_end_posting_after_insert_post_action', 'f4d_convert_metadata', 10, 1);
Below is the code which I found in your forum used for gravity form. So if possible, please
// capture a GF checkbox field values and serialize so WP Types CPT can display checked properly
add_action("gform_after_submission", "add_custom_post_meta", 10, 2);
function add_custom_post_meta($entry, $form) {
$arr = array(
array('my-checkboxes1', '123'),
array('my-checkboxes2', '456'),
array('my-checkboxes3', '789'),
);
foreach($arr as $v){
$items = get_checkbox_value( $entry, $v[1] );
$value = my_checkboxes_func($items, $v[0]);
update_post_meta($entry['post_id'], 'wpcf-' . $v[0], $value);
}
}
function get_checkbox_value( $entry, $field_id ){
//getting a comma separated list of selected values
$lead_field_keys = array_keys( $entry );
$items = array();
foreach ( $lead_field_keys as $input_id ) {
if ( is_numeric( $input_id ) && absint( $input_id ) == $field_id ) {
$items[] = GFCommon::selection_display( rgar( $entry, $input_id ), null, $entry['currency'], false );
}
}
//$value = GFCommon::implode_non_blank( ', ', $items );
return $items;
}
function my_checkboxes_func($items = array(), $types_field = '') {
$fields = WPCF_Fields::getFields();
$arr = array();
if(isset($fields[$types_field]['data']['options'])){
foreach ($fields[$types_field]['data']['options'] as $k=> $v){
if(in_array($v['set_value'], $items)){
$arr[$k] = array($v['set_value']);
}
}
}
return $arr;
}