The solution is to merge existing options before saving options in case not all options are presented on the page we are about save.
So in the end of $sanitize_callback
in register_setting function just before I return the data I call below function where $existing are all existing options saved in database.
function merge_options( $existing, $input ) { // Merges existing options with $input to preserve existing options
if ( !is_array( $existing ) || !is_array( $input ) ) // something went wrong
return $data;
return array_merge( $existing, $input );
}
Related Posts:
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is get_option function cached?
- What are the advantages to the Settings API?
- Where to store plugin settings fields
- What’s the best method for emptying an option created with the Settings API?
- Why won’t register_setting() create a setting?
- Performance of several get_option() calls
- Extend plugin options page
- Correct way check nonce (security) using old Options API
- How to add settings subpage from a plugin to a settings page created in theme?
- Remove Internal Style Sheet if no Value Provided?
- WordPress setting with select – where is my mistake?
- Custom delete option button in plugin settings
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Update problem with update_option() in combination with register_setting()
- Issue on Checkbox with Custom Option Page
- Settings API: Setting default option via ‘get_option’ fails
- Plugin setting page – update_option problem
- add_settings_error on validating plugin options API
- How do I build a settings panel under the plugin
- Add_menu_page and saving settings
- Options don’t save, validation callback not executed
- Settings API not Saving to Database or Display
- Admin Message after Plugin Option Updated
- How come `wp_options` table does not have an index on `autoload`?
- Update Option Stored in Multi-Dimensional Array
- Adding Widget form fields dynamically
- Releasing new plugin version, how to rename old options keys?
- How to properly sanitize strings for update_option()
- Which to use to execute code during the saving of a plugin settings page?
- Custom plugin settings: clicking “save changes” does not display success message
- How do I handle multiple Submit buttons in plugin’s option page?
- Deletion of shared options using uninstall.php
- Add Admin Menu Inside Construct or Init
- Settings API – Undefined Index when unchecking checkbox
- Disable $title in Plugin Options Screen?
- WordPress Settings API: saving multiple rows of similar data
- Dropdown list of pages to get page id to store in plugin options
- update_option is not working!
- Save user-specific options in WordPress admin
- Creating option to allow user to select the page my plugin content will display on
- Unified Approach for Placing Option Pages
- Does settings API create settings on run time?
- WordPress plugin options and jQuery
- WordPress Plugin Setting’s POST
- plugin development: storing language specific options
- How to add a secondary button to a settings page with a custom action?
- Settings not set after calling register_setting()
- Using the Settings API, how should I add multiple values to an option?
- Plugin options not being saved or created
- What could cause my plugin’s options/settings page not to load?
- How to set “Site Address (URL)” programmatically on WP multisite?
- Using wp_parse_args to set up Plugin Default Settings
- Callback is not called in add_settings_field() when passed as part of an array, but recognises that it’s there. It’s passed Class to Class using OOP
- When to use add_settings_section vs just register_setting?
- Storing product price data in the database
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Plugin development: can’t update settings with multiple settings sections
- Whitelisting items from custom options page
- Parse form values before sending to options.php
- Settings API with arrays example
- Insert/Update values to a table after blogname option etc. is updated
- wordpress how to query wp_options table
- How Can I add Fields in wp-option table?
- Plugin Options Array Set to Undefined
- Checked() function on a multidimensional array
- Can I use register_settings and unregister_setting once the settings page has loaded?
- The Correct Way to Use Nonce Field without Settings API
- how to save wp_editor html content in options table
- Custom Plugin Options Won’t Update
- settings api – add_settings_section not working
- custom wp_editor does not save the content in plugin settings
- Plugin settings are saving but the fields
- why does get_option( ‘home’ ) not work while using in plugin [closed]
- Plugin Options not saving options and doesn’t work
- Pause plugin option page until all data manipulation is complete
- How to make sure settings are not lost when plugin is updated?
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Add multiple checkboxes as single field to Custom Shipping Method Settings Page
- How does one update complex options?
- Sanitization and validation input fields – Settings API
- Plugins Settings page not updating
- How to create plugin settings page for each admin user?
- How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons
- Array/List Edit in Backend
- How to Modify My Plugin’s Admin Settings so that the Plugin can be Added to a Specific Page?
- What should I use instead of get_blog_option?
- Tie specific functions to options-update for limiting API requests
- When using an options array the Settings API isn’t creating the database record
- Can’t switch theme after activation
- Generate activation url
- Validating values using Settings API?
- Settings API with arrays example
- the correct way to use options from settings page [closed]
- Saving multiple fields as array
- WordPress Plugin default option
- Modify a Themes Appearance >> Header admin screen from a plugin
- Update custom settings field in plugin
- move setting data from wordpress api to codestar freamwork