Hmm, couldn't find anywhere the JSON value is stored.
However, I found something confusing in your code:
This part:
if( is_string($field['value']) && is_array(json_decode($field['value'], true)) ) {
$array = json_decode( $field['value'] );
$i = 0;
foreach( $array as $value) {
update_post_meta($post_id, '_property_' . $new_level . '_' . $field['key'], $value[$i]);
$i++;
}
} else {...}
Here you check if $field['value']
is a json-string. But when you decode it with $array = json_decode( $field['value'] );
, then $array
will be an object! Not sure why the next foreach
loop work.