/* This is my plugin activation_hook. What am I doing wrong? Why are the options not being updated correctly? */ function cud_install_options(){ $defaults = array( 'custom_upload_dir' => '', 'all_parents' => true, 'flatten_hierarchy' => false, 'only_leaf_nodes' => false, 'only_base_nodes' => false, 'test_ids' => '-1', 'template' => '' ); $old = get_option('custom_upload_dir'); if(is_array($old)){ if(!empty($old['template'])){ //update deprecated placeholders $newtags = array('%post_id%','%postname%','%author%','%monthnum%'); $oldtags = array('%ID%', '%post_name%','%post_author%','%month%'); $old['template'] = str_replace($oldtags, $newtags, $old['template']); } $defaults = array_merge($defaults, $old); } update_option('custom_upload_dir', $defaults); }