Im trying to trigger a configuration everytime I create a new subsite on multisite environment, like so:
add_action('init', 'mgh_set_events_option', 99);
function mgh_set_events_option(){
$mgh_is_set_options = get_option('mgh_is_set_options');
if(!$mgh_is_set_options){
print_r('setting options');
update_option( 'mgh_is_set_options', true );
}
}
The problem is that the 'init' action does not trigger in some sites from our multisite instance. There is any principle of why this happens?
functions.php
, it'll only run on sites where that theme is active. You can ensure that it's active on all your sites by putting that code snippet into a plugin that's active on every site (or in a Must-Use plugin).