Hi,
I am hooking into a function of the wp all import-plugin to readout data from a serialized regular custom field and move it over to a metabox-field, which is in a custom table. this is my code to loop through the various fields:
$data = get_post_meta( $postid, 'all_data', true);
$fields = [
'address',
'city',
'zip',
'state',
'email',
'url',
'phone'
];
// Loop through data
foreach( $fields as $field ) {
if( array_key_exists( $field, $data ) ) {
rwmb_set_meta(
$postid,
$field,
sanitize_text_field( $data[$field] )
);
}
}
If I push data to error_log I can see all the necessary data. However, rwmb_set_meta does not save anything. My custom table is empty 🙁
What do I do wrong?