$network_wide argument on plugin activate hook in multisite always empty string?
-
I’m seeing strange behavior contrary to the WordPress documentation as well as contradicting this WP StackExchange answer regarding the value of the
$network_wide
argument for plugin activation hooks. Specifically, no matter when/where I test the value of$network_wide
, the value is always an empty string. Example code/test case:<?php /** * A test plugin for the network_wide argument. * * WordPress plugin header information: * * * Plugin Name: Test Plugin * * Plugin URI: https://example.com/ * * Description: This plugin tests whether or not the network_wide argument is correctly passed. * * Version: 0.1 * * Author: Meitar <[email protected]> * * Author URI: https://maymay.net/ * * License: GPL-3 * * License URI: https://www.gnu.org/licenses/gpl-3.0.en.html */ function test_plugin_activate($network_wide) { var_dump($network_wide); exit(); } register_activation_hook(__FILE__, 'test_plugin_activate');
When activated on a subdomain-based multisite install, this code produces an error:
Plugin could not be activated because it triggered a fatal error. string(0) ""
My first instinct is to assume I have done something wrong. I am using a VVV multisite development environment and still get this error.
I have searched Core Trac but the only ticket that seems relevant (ticket:14170) seems to have been closed years ago.
Am I missing something obvious or is this a regression?
P.S. I asked this over on StackExchange, too.
- The topic ‘$network_wide argument on plugin activate hook in multisite always empty string?’ is closed to new replies.