Skip to content

Commit

Permalink
Defer pluginHooks() to the 'plugins_loaded' hook (#25)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markjaquith authored Dec 4, 2020
1 parent 9ef7590 commit f508348
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f508348

Please sign in to comment.