From f508348a3365ab5ce7e045f5fd4ee9f0a30dd70f Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 4 Dec 2020 10:59:12 -0500 Subject: [PATCH] Defer pluginHooks() to the 'plugins_loaded' hook (#25) This ensures that pluggable functions are available when the activation hooks are fired. The priority is -9999 so that the activation hooks likely fire before any other functionality the plugins are attempting. fixes #24 --- src/Autoloader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Autoloader.php b/src/Autoloader.php index 25adfee..bbefcd9 100644 --- a/src/Autoloader.php +++ b/src/Autoloader.php @@ -64,7 +64,7 @@ public function loadPlugins() include_once WPMU_PLUGIN_DIR . '/' . func_get_args()[0]; }, array_keys($this->cache['plugins'])); - $this->pluginHooks(); + add_action('plugins_loaded', [$this, 'pluginHooks'], -9999); } /** @@ -134,7 +134,7 @@ private function updateCache() * loaded as usual. Plugins are removed by deletion, so there's no way * to deactivate or uninstall. */ - private function pluginHooks() + public function pluginHooks() { if (!is_array($this->activated)) { return;