If you are using the Settings API then you don’t have to save the options, that’s done for you. So when using an array to store the options your validation function should get an array of all existing options, update only the changed and return that array.
Something like this:
function my_settings_option_validate( $input ) {
//do regular validation stuff
//...
//...
//get all options
$options = get_option('my_plugin_options');
//update only the neede options
foreach ($input as $key => $value){
$options[$key] = $value;
}
//return all options
return $options;
}
Related Posts:
- Updating wp_options with an array on save_post results in duplicated entries
- Echoing a variable inside a function
- WP Page Options Array
- Ways of dealing with nested arrays within option
- Strange Behavior with update_option
- WPML admin texts with serialized objects
- Echo the key from a select-box in Array with get_option (Settings API)
- How to store widget fields data as an array?
- Nice way to print_r arrays
- Why does get_users suddenly return duplicates?
- get_option function
- Settings API – save an array of options as one setting (array_push?)
- WordPress: How to use post_class() in an echo
- How do I pass an array as an argument to a WP-CLI command?
- Passing a variable into Contact Form 7 [closed]
- How to fetch serialized data from wordpress options
- Comma seperated list of ID’s as an array?
- update_post_meta from data in multidimensional array created from a form
- Multiple entries in get_option results? or why is _multiwidget set to 1?
- post__in works but also prints the word Array
- Make Selected Mutiselect Items “selected”
- settings api store multiple array
- if is_singular array not working as expected
- How to save WordPress Options as an array?
- How do I update a specific object in an array, in user meta?
- array_map() for sanitizing $_POST
- Get posts id in array by meta value and key
- How to save array of datas in option page by setting api?
- Sort a custom post type array numerically
- How to add day number and initial to my post graph?
- How do I output a database option that is an array into a get_posts array?
- How to validate register settings array
- How to check an array of $curauth fields?
- Problem with wp_update_post
- Replace text inside a huge multidimensional array
- Working with an Array inside Your Theme Options Array – Multiple Values
- How to use IN array properly in WordPress?
- Only a part of array is stored in transient – what could be causing this?
- update_post_meta() with a modified array?
- How to get update_post_meta output to include string length
- Return array keys and values
- How pass a 0 in $atts?
- How to save data of an input field to an array
- Retrieving multiple values to the Post Meta (using an array)
- Stuck with a Custom Field Check box Array
- Compare with WP Meta Query
- How to Translate a string of an array inside a class?
- How to pass conditional array to wp_localize_script
- Modify foreach loop for social sharing links?
- Combine get_page_by_title to exclude pages from wp_list_pages
- How can I make my options in an array and store theme in WP options one DB row?
- Plugin settings page checkbox not saving – one options array with sub array
- Selecting and outputting results from DB with an array
- Struggling with array and foreach loop
- Update post meta does not serialize array
- Customizer Settings in Arrays
- Redirect to another page using contact form 7? [closed]
- WordPress i18n in Array throws Error
- How to use json_decode a post_meta value? [duplicate]
- How to decipher the following array
- Save meta box values as an array to wp_postmeta
- How to display line breaked meta values in table?
- Plugin Options Array Set to Undefined
- Organizing and grouping an array by year
- Time & Date on Post – Time Ago Custom Function
- array_filter warning – wp-includes/post.php line 3148
- Hide sidebar if post_type is in array
- Array in meta key?
- Saving array keep adding length of array
- Obtaining values from objects
- How to get a page array and category array going at the same time?
- How do I retrieve multiple values from a multidimensional array in wp_options?
- get_the_terms, whether I should use string or array as the second parameter?
- Obtaining array item from WordPress revisions output
- Matching slug terms from one array to those in array of WP_Term objects to output term names
- Print specific values stored in a post meta array
- Do not replicate items if they exists in a foreach loop
- Array is not working in Filter?
- Adding option values as an array using a multi selectable select box
- How to put an array in wp user query
- Get the values from an array string to work with post__in
- return paginate_comments_links() as array
- Inserting a random number into an array [closed]
- Get array value
- Random element in get_post_meta array
- update_user_meta duplicates entry
- Add formatting to Array
- How to randomise my menu items?
- Decontruct serialized data array from wp_options
- Taxonomy terms not properly displaying as array
- Creating an array from form inputs before it is posted to the options database
- WordPress, result array of ‘post_name’
- Why are array_slice() and array_chunk() not working?
- Retrieve array items without page ID
- WordPress Settings API Overrides My Previous Value
- How do i fix this “call_user_func_array()” error
- How can I get the content of the current page in my loop while merging post-type
- wp_insert_post($post), add an array of values with update_post_meta
- update_post_meta adding to array instead of replacing value
- Add Array record to Meta Post