Submenu pages delete settings from options array when saved

Yep you are missing something, On your validate_options function you need to:

  • get an array of all existing options.
  • update only the options your Submenu
    page handles.
  • return that array.

So something like:

function validate_options($input){
    //do regular validation stuff
    //...
    //...

    //get all options
    $options = get_option(THEMENAME . '_settings');
    //update only the neede options
    foreach ($input as $key => $value){
        $options[$key] = $value;
    }
    //return all options
    return $options;
}

Leave a Comment