File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,31 @@ Feature: Manage WordPress plugins
751751 | name | title | description |
752752 | test -mu | Test mu -plugin | Test mu -plugin description |
753753
754+ Scenario : Listing mu-plugins should include plugins from subfolders
755+ Given a WP install
756+ And a wp-content/mu-plugins/test-mu-root.php file:
757+ """
758+ <?php
759+ // Plugin Name: Test MU Root
760+ // Description: Test mu-plugin in root
761+ // Version: 1.0.0
762+ """
763+ And a wp-content/mu-plugins/subfolder-plugin/subfolder-plugin.php file:
764+ """
765+ <?php
766+ /**
767+ * Plugin Name: Subfolder MU Plugin
768+ * Description: Test mu-plugin in subfolder
769+ * Version: 2.0.0
770+ */
771+ """
772+
773+ When I run `wp plugin list --status=must-use --fields=name,title,version`
774+ Then STDOUT should be a table containing rows:
775+ | name | title | version |
776+ | test -mu -root | Test MU Root | 1 .0 .0 |
777+ | subfolder -plugin | Subfolder MU Plugin | 2 .0 .0 |
778+
754779 @require-wp-5.5
755780 Scenario : Listing plugins should include name and auto_update
756781 Given a WP install
Original file line number Diff line number Diff line change @@ -239,7 +239,20 @@ protected function status_single( $args ) {
239239 protected function get_all_items () {
240240 $ items = $ this ->get_item_list ();
241241
242- foreach ( get_mu_plugins () as $ file => $ mu_plugin ) {
242+ // Get all mu-plugins including those in subfolders.
243+ $ mu_plugins = get_mu_plugins ();
244+ if ( defined ( 'WPMU_PLUGIN_DIR ' ) ) {
245+ $ mu_plugins_subfolder = get_plugins ( '/../ ' . basename ( WPMU_PLUGIN_DIR ) );
246+ // Merge subfolder plugins with the main mu-plugins list.
247+ foreach ( $ mu_plugins_subfolder as $ file => $ plugin_data ) {
248+ // Only add if not already in the list (avoid duplicates from root-level plugins).
249+ if ( ! isset ( $ mu_plugins [ $ file ] ) ) {
250+ $ mu_plugins [ $ file ] = $ plugin_data ;
251+ }
252+ }
253+ }
254+
255+ foreach ( $ mu_plugins as $ file => $ mu_plugin ) {
243256 $ mu_version = '' ;
244257 if ( ! empty ( $ mu_plugin ['Version ' ] ) ) {
245258 $ mu_version = $ mu_plugin ['Version ' ];
You can’t perform that action at this time.
0 commit comments