Hi dear support,
I have 2 custom fields: "quota_usage" and "quota_monthly" in a custom "websites" table.
In fine I want to create a CRON job to reset every month the "quota_usage" with the value of "quota_monthly" of each post (note that it's a CPT).
Now I am just testing to update the data "manually" like so :
add_action( 'init', function() {
$table_name = 'websites';
$post_id = 532;
// we get the monthly credit
$quota_monthly = rwmb_get_value( 'quota_monthly', ['storage_type' => 'custom_table', 'table' => $table_name], $post_id );
// we reset the quota_usage with the quota_monthly credit
$field_id = 'quota_usage';
$value = $quota_monthly;
rwmb_set_meta( $post_id, $field_id, $value, [
'storage_type' => 'custom_table',
'table' => $table_name,
] );
}, 99 );
When I look at the outputted value it looks good but on the backoffice I still see the previous value in the input... My guess is that the value is not properly saved in the DB...
What am I doing wrong?
Thanks for your help 🙂