options.php
does not automatically save in the database anything that you post to it. You must also tell the page which options it should look for in the posted data.
I see that you have set option_page
to admin_bar
, which is half of the solution. The other half is to add the option names to the whitelist. You are using the form element name admin_bar_[admin_bar_toggle]
which will show up as $_POST['admin_bar_']['admin_bar_toggle']
when the form is submitted with that box checked. This filter should tell options.php
that you want this option saved:
function admin_page_whitelist_options( $whitelist_options ) {
$whitelist_options['admin_bar'] = array( 'admin_bar_' );
return $whitelist_options;
}
add_filter( 'whitelist_options', 'admin_page_whitelist_options' );
After that, you should find what you are looking for in the option named admin_bar_
.