I am making a starting-point Wordpress theme that will be used on dev projects. In this theme, I am automating common plugin installs that are used on every project. I have been able to automate Wordpress Core settings using the update_options()
function.
What I now want to do is update options of plugins in the same manner, but I am not having any success.
For example, I use Search Everything as a typical plugin. I have my own search keyword highlighter, so I want to make sure that the plugin setting for search term highlighting is always off (as to not interfere). Here is the code I'm working with:
add_action('admin_init', 'nebula_plugin_force_settings');
function nebula_plugin_force_settings(){
if ( file_exists(WP_PLUGIN_DIR . '/search-everything') ) {
//Tried the option slug in the array():
update_option('se_use_highlight'], false);
//Tried hard-coding the array and key:
update_option('se_options["se_use_highlight"]', false);
//Tried setting the array as a variable:
$se_options = get_option('se_options');
update_option($se_options['se_use_highlight'], false);
}
}
None of those attempts worked. I feel like I'm getting close because when I var_dump()
the array, or echo the get_option()
I can see the setting, but I just can not update that setting. Any ideas?