Processing the following form in the admin area, but the database constantly returning an empty cell where the info should be. Help!!

<form action="options.php" method="post">

            <input type="hidden" value="admin_bar" name="option_page"><input type="hidden" value="update" name="action"><input type="hidden" value="fd5754f034" name="_wpnonce" id="_wpnonce"><input type="hidden" value="/accessibilitysite/wp-admin/options-general.php?page=admin_bar&amp;settings-updated=true" name="_wp_http_referer">

            <table class="form-table">

        <tbody><tr valign="top"><th scope="row">Admin Toggle</th>
                                <td><input type="checkbox" value="admin_bar_toggle" name="admin_bar_[admin_bar_toggle]"><p>Turn Admin Bar On ?</p></td>



            <p class="submit">

            <input type="submit" value="Save Changes" class="button-primary">


  • Errmm.... value=""? Checkboxes still need a value.
    – t31os
    Mar 30, 2011 at 15:54
  • sorry, silly mistake. It's still not saving anything useful. I know this is rookie. Sorry
    – Mild Fuzz
    Mar 30, 2011 at 16:05
  • As Andy has pointed out, unless the option is whitelisted, options.php won't save your data, typically the easiest way to whitelist an option(or set of options) is using register_setting, without that though your option doesn't make it past the whitelist. Andy has provided a solution for you though... :)
    – t31os
    Mar 30, 2011 at 16:39
  • Silly HTML error. The problem was having a value. Removing it allowed the code to save the string "on" when the checkbox was ticked, and I can build my logic around that.
    – Mild Fuzz
    Mar 31, 2011 at 10:31

1 Answer 1


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_.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.