5

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.

  • 1
    Such a mess... +1 for your question. Have I already said that WP can be really, really annoying? – kaiser Nov 20 '13 at 15:45
  • 1
    Note: based on feedback from @toscho, I'm currently testing with the Plugin network activated rather than activated on a single network site. I'll edit the question once I see the results. – Chip Bennett Nov 20 '13 at 17:21
  • Any progress on this question? – kaiser Feb 9 '14 at 15:45
  • 1
    No, and I'm at a loss. Would be helpful, maybe, to promote the question outside of WPSE so that the right WPMS people might see it? – Chip Bennett Feb 9 '14 at 17:25
1

Maybe the hook init is to late for the class and method go(), the update functions run earlier? The hooks muplugins_loaded and update_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. enter image description here

  • I'm testing by hooking into plugins_loaded. I'll report back if it impacts anything. – Chip Bennett Nov 25 '13 at 13:02
  • What is this plugin you made the screenshot with if I may ask? – NextGenThemes Jul 9 '14 at 19:56
  • The WordPress-plugin Debug Objects – bueltge Jul 10 '14 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.