Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Implementation Complete: Add support for listing mu-plugins from subfolders

  • Understand the current implementation of get_all_items() in Plugin_Command.php
  • Modify get_all_items() to also fetch plugins from mu-plugins subfolders using get_plugins()
  • Ensure the subfolder mu-plugins are displayed with "must-use" status
  • Create a test scenario to validate the change
  • Run static analysis and code style checks - all passing
  • Address code review feedback - refactored with array_replace for better readability
  • Run security analysis - no issues found

Summary

This PR adds support for listing must-use plugins located in subfolders within the mu-plugins directory. Many WordPress sites use mu-plugin loaders like Bedrock Autoloader or WPStarter MULoader to load plugins from subfolders. These plugins are displayed in the WP admin backend but were not being listed by wp plugin list before this change.

Changes Made:

  • Modified Plugin_Command::get_all_items() to fetch plugins from mu-plugins subfolders using the standard WordPress approach: get_plugins( '/../' . basename( WPMU_PLUGIN_DIR ) )
  • Used array_replace() to merge root-level and subfolder mu-plugins with proper precedence
  • All subfolder mu-plugins are marked with "must-use" status to match WordPress behavior
  • Added Behat test scenario "Listing mu-plugins should include plugins from subfolders"
  • Refactored for better readability with descriptive variable names

Testing:

  • All lint checks pass ✅
  • PHPCS code style checks pass ✅
  • PHPStan static analysis passes ✅
  • CodeQL security analysis - no issues ✅
  • New test scenario added to validate functionality ✅

Code Quality:

  • Minimal changes (3 lines of new code + test)
  • Clear, concise implementation using array_replace()
  • Descriptive variable names for better code clarity
  • No breaking changes to existing functionality
  • Follows WordPress coding standards
Original prompt

This section details on the original issue you should resolve

<issue_title>Listing folders in mu-plugins</issue_title>
<issue_description>A lot of more complex sites make use of subfolders in the muplugins folder, just like with regular plugins.

They then use something like the Bedrock Autoloader or the MULoader in WPStarter.

Although these plugins are then active like normal plugins and properly shown in the WP admin backend, WP-CLI does not display them with plugin list.

To correctly mirror WP behaviour, these should be shown as well if they are active.</issue_description>

<agent_instructions>Plugin_Command::get_all_items() could use get_plugins( '/../' . basename( WPMU_PLUGIN_DIR ) ) and add those plugins to the list.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add support for listing active mu-plugins in WP-CLI List mu-plugins from subfolders Jan 12, 2026
Copilot AI requested a review from swissspidy January 12, 2026 10:36
@codecov

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

@github-actions github-actions bot added command:plugin Related to 'plugin' command command:plugin-list Related to 'plugin list' command scope:testing Related to testing state:unconfirmed labels Jan 12, 2026

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review January 12, 2026 16:40
@swissspidy swissspidy requested a review from a team as a code owner January 12, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin Related to 'plugin' command command:plugin-list Related to 'plugin list' command scope:testing Related to testing state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Listing folders in mu-plugins

2 participants