The ska_plugin_get_options_{slug} filter can be used to filter plugin and theme options:
add_filter('ska_plugin_get_options_ska_blocks', function($options) {
if(defined('WP_DEBUG') && WP_DEBUG && !is_admin() && !wp_is_rest_endpoint()) {
$options['styleCacheMode'] = 'off';
}
return $options;
});Note that the filter will also apply on the admin settings page, so with the styleCacheMode being set to off, the next time you edit and save settings the value will be written to the database – this is why the code also checks for !is_admin() && !wp_is_rest_endpoint() to prevent that from happening.
add_filter('ska_plugin_get_options_ska_theme', function($options) {
/** Incorrect usage (always overrides the option value): */
// $options['trackScrollPosition'] = is_singular('page') && get_the_ID() === 123;
/** Correct usage (only overrides the option value when applicable): */
if(is_singular('page') && get_the_ID() === 123) {
$options['trackScrollPosition'] = true;
}
return $options;
});