Hi, I want to use hook rwmb_frontend_insert_post_data
and rwmb_frontend_update_post_data
to modify custom field data in submitted post data. For example, an custom fields, called calorie, whose data type is hidden
is stored in a custom table. I tried to use the following code to modify the data of calorie but failed.
add_filter( 'rwmb_frontend_insert_post_data', function( $data, $config ) {
// Make sure you work on the correct form.
if ( 'diet_form' !== $config['id'] ) {
return $data;
}
$data['calorie'] = '100';
return $data;
}, 10, 2 );
Is there a trick I'm not aware of?
Thanks,
pctsai