Skip to content

Commit

Permalink
fix: is_plugin_active doesn't work when plugin is in mu-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
carlalexander committed May 4, 2022
1 parent 9b4e3b6 commit 49d0bb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ public function getContainer(): Container
return $this->container;
}

/**
* Checks if the plugin is active.
*/
public function isActive(): bool
{
return is_plugin_active($this->container['plugin_basename']) || preg_match('#mu-plugins/[^/]*/ymir\.php$#i', $this->filePath);
}

/**
* Checks if the plugin is loaded.
*/
Expand Down
2 changes: 1 addition & 1 deletion ymir.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
$ymir->load();

// Load Ymir pluggable functions if the plugin is active
if (is_plugin_active(plugin_basename(__FILE__))) {
if ($ymir->isActive()) {
require_once __DIR__.'/pluggable.php';
}

0 comments on commit 49d0bb8

Please sign in to comment.