Related to this question:
How Do I Configure Automatic Updates in WordPress 3.7?
I help maintain the Update Control Plugin – source on wp dot org/trunk. The Plugin is quite simple; it sets filters based on Plugin options. For example, to enable automatic upgrade for Plugins:
if ( $options['plugin'] ) {
add_filter( 'auto_update_plugin', '__return_true', 1 );
}
Everything works fantastically, except in a Multisite Network.
For a Multisite Network environment, the Plugin is designed to be active only on the main network site:
if ( is_multisite() && ! is_main_site() ) {
// Multisite check
// only run on the main site of a multisite network
return;
} else {
// do stuff
}
(Note: I know that the conditional is overkill; ! is_main_site()
is sufficient; something I’ll clean up in the next release.)
I’ve got the class hooked into init
:
add_action( 'init', array( 'Stephanis_Update_Control', 'go' ), 0 );
For reference, here is the full code.
The Plugin is installed and active on the Main site. But the updates do not fire. I’ve tested on multiple networks on multiple hosts. In all environments, the updates fire for single-site installs, and not for multisite networks.
Am I missing something obvious? I’ve checked the core upgrade class, and can’t find anything.
Note: I would intentionally like to avoid hooking into the Network Admin for the Plugin options. I have the Plugin options being rendered on the core Settings -> General screen, as opposed to adding a Plugin-specific settings page. So, I’ve not tried that route for debugging.
Maybe the hook
init
is to late for the class and methodgo()
, the update functions run earlier? The hooksmuplugins_loaded
andupdate_option
start before the init.I have not test your code, is only a hint, not a solution. Maybe also helpfull a analyse of the hook order in the screenshot, create via plugin.