• Hello,

    In my plugin code I am registering my activation and deactivation hook functions, each with the $network_wide parameter as this is intended to be a multisite plugin.

    
    function my_activation_hook($network_wide) {
    	if ($network_wide) {
    		//do something on all sites
    	}
    	else {
    		//do something on current site
    	}
    }
    
    function my_deactivation_hook($network_wide) {
    	if ($network_wide) {
    		//do something on all sites
    	}
    	else {
    		//do something on current site
    	}
    }
    
    register_activation_hook(__FILE__, 'my_activation_hook');
    register_deactivation_hook(__FILE__, 'my_deactivation_hook');
    

    In the deactivation hook the $network_wide parameter is passed as expected i.e. boolean true when network deactivated and boolean false when deactivated on a site. However, in the activation hook, the parameter is always a blank string ”. Has anyone else experienced this? I have tried this on multiple installations (windows and linux) and it seems consistent in the 4.9.4 version at least.

    Thanks,
    Asif

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Not me. I get true when activating network wide. Also on 4.9.4. Sorry for the slow reply, access to my multisite for testing was not possible until now.

    Try deactivating all other network plugins and themes except for one of the default twenty* themes. In this configuration you should get true passed when doing a network activation. If so, it indicates one of your plugins or themes is causing the parameter to be corrupted. I’ve no idea how that might be possible.

    Once you’ve seen true being passed in a basic state, network activate your normal modules, one at a time, testing after each. Narrow down which module is the culprit. Either do without or start debugging it or notify the responsible author.

Viewing 1 replies (of 1 total)
  • The topic ‘$network_wide parameter always ” in registered activation hook function’ is closed to new replies.