How to update a key-value of an array in php (Wordpress)?


in wordpress we have a function called get_option( $option, $default );. I do use this to call the option ws_plugin__s2member_options which is an array. Here i do change the value of the key custom_reg_fields and save it into a variable. With the following code i do “replace” this value ($outall contains the new value):

foreach(  $options as $k=>&$v ){
   if( $k == "custom_reg_fields"){ 

When i do a print_r($options['custom_reg_fields']); i do get my new value as output on my page. But in my database i still have the old one. I know that there is a function called update_option( $option, $new_value, $autoload ); in wordpress. But this i giving me just the option to update the whole options-array. But i do need to update just the value of the key custom_reg_fields which is in the array ws_plugin__s2member_options. Has somebody an idea how to solve this?

Thanks in advance!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.