How to save the option’s new values plus old value without overwrite old one
You are misspelling the variables names. You define them as $new_value and $old_value with underscore that you forgot about. Except this your code working fine. function myplugin_update_field_foo( $new_value, $old_value ) { if ($new_value !== $old_value && is_array($old_value) && is_array($new_value)) { $new_value = array_unique( array_merge( $new_value, $old_value ) ); } return $new_value; } To get the … Read more