wp-cli / extension-command

Manages plugins and themes, including installs, activations, and updates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make "wp plugin list" return all mu-plugins that are loaded

StanvanHoorn opened this issue · comments

Feature Request

Context

We use a combination of standard and Bedrock WordPress installations. Some automated tooling we use use various wp-cli commands to fetch information from our WordPress installations. An example is plugin update availability monitoring.

Problem

We noticed while running wp plugin list for our Bedrock installations that not all mu-plugins are returned . This seems to be by design, as plugins are fetched with the standard WordPress get_plugins() function. The get_plugins() function only returns plugins in standard directories and not in mu-plugins subdirectories. Bedrock includes an autoloader that loads mu-plugins in subdirectories. This practice is also described in the WordPress documentation about the must-use plugins; WordPress only looks for PHP files right inside the mu-plugins directory, and (unlike for normal plugins) not for files in subdirectories. You may want to create a proxy PHP loader file inside the mu-plugins directory

Request

We would like to be able to receive all installed plugins with wp plugin list. For backwards compatibility it might be better to add a flag like --with-autoloaded.

Thanks for the suggestion, @StanvanHoorn !

We noticed while running wp plugin list for our Bedrock installations that not all mu-plugins are returned . This seems to be by design, as plugins are fetched with the standard WordPress get_plugins() function.

Given this issue is specific to Bedrock, and get_plugins() is filterable, I think your suggested change is most appropriate for Bedrock to make. It should be possible to filter Bedrock's behavior specific to WP-CLI.