Hi,
just found that thread here and I'm facing a similiar problem.
I tried to use the rwmb_set_meta()
function for updating a value in a setting page. Unfortunately that value doesn't get updated. Refering to your docs (Docs) i used the option_name as object_id.
That's what my options-page looks like:
function wcmvw_settingsPage_register($settings_pages) {
global $vendorNames;
//$vendorNames = get_option( 'wcmvw_settings' )['wcmvw_settings_vendorName'];
$settings_pages[] = [
'id' => 'wcmvw_settings',
'option_name' => 'wcmvw_settings',
'menu_title' => __( 'Rechnungen', 'wcmvw' ),
'position' => 0,
'parent' => '',
'style' => 'no-boxes',
'columns' => 1,
'tabs' => [
'wcmvw_settings_general' => 'Allgemeine Einstellungen',
],
'tab_style' => 'left',
'submit_button' => __( 'Änderungen speichern', 'wcmvw' ),
'message' => __( 'Änderungen wurden gespeichert!', 'wcmvw' ),
'icon_url' => 'dashicons-admin-generic',
];
// Add Tabs dynamically!
foreach ($vendorNames as $vendor) {
$settings_pages[0]['tabs'] += [ str_replace(" ", "_", $vendor) => $vendor];
}
return $settings_pages;
}
And that's what that specific kind of code looks like:
$settings_page = get_option('wcmvw_settings');
$settings_page[$vendorInOrder[$i] . '_wcmvw_invoiceNumberGeneral_field'] = $vendorNextInvoiceNumber+1;
update_option('wcmvw_settings', $settings_page);
//rwmb_set_meta( 'wcmvw_settings', $vendorInOrder[$i] . '_wcmvw_invoiceNumberGeneral_field' , 'test' );
I've commented it out since the "native" option as suggested from you works fine for now. But i would, of course, prefer to use rwmb_set_meta
here.
Any thoughts what I'm doing wrong?
Thanks in Advance!
Cheers!