Can you provide your CMB2 code to get this page set up, so that we can give it a try on our end for what you’re experiencing
…yep, you’re right, sorry…
$prefix = '_themename_options_';
$main_options = new_cmb2_box(array(
'id' => $prefix . 'main_options_page',
'title' => esc_html('Options title', '_themename-site'),
'object_types' => array(
'options-page'
),
'context' => 'normal',
'priority' => 'high',
'option_key' => '_themename_main_options', // The option key and admin menu page slug.
'icon_url' => 'dashicons-building', // Menu icon. Only applicable if 'parent_slug' is left empty.
'capability' => 'manage_options', // Cap required to view options-page.
'position' => 2 // Menu position. Only applicable if 'parent_slug' is left empty.
));
/**
* MAIN OPTIONS META - TITLE
*/
$main_options->add_field(array(
'id' => $prefix . 'main_options_title',
'name' => esc_html('General infos', '_themename-site'),
'type' => 'title'
));
/**
* MAIN OPTIONS META - COMPANY NAME
*/
$main_options->add_field(array(
'id' => $prefix . 'main_options_company_name',
'name' => esc_html('Name', '_themename-site'),
'desc' => esc_html('Insert name', '_themename-site'),
'type' => 'text'
));
[etc...]
-
This reply was modified 6 years, 4 months ago by
saxpaolo.
Hmm.
Using everything except the “[etc…]” i am managing to get the “name” field to fill in, save, and then empty upon save as well.
That said, I’m also seeing a “Nothing to update.” admin notice, and the theme option is still in place in the database, but just has an empty serialized array.
Are you seeing different from that?
What I see is that it looks like I can update data using everything except an empty field. Also, if I press the save button even without performing any edit to input fields data, I always get an “Settings updated” admin notice.
(For the sake of information, I’m working on roots/bedrock based environment, while the CMB2 package is installed inside a wppb boilerplate based plugin, included as a mu-plugin)
-
This reply was modified 6 years, 4 months ago by
saxpaolo.
-
This reply was modified 6 years, 4 months ago by
saxpaolo.
hmm. I wonder if there’s some sort of conflict going on somehow somewhere in your install, since as is I wasn’t able to recreate myself, outside of the weird admin notice when it did succeed for me.