Skip to content

Allow multiple values for field filter options in wp plugin list and wp theme list#511

Merged
swissspidy merged 3 commits intomainfrom
copilot/add-multiple-values-field-option
Mar 10, 2026
Merged

Allow multiple values for field filter options in wp plugin list and wp theme list#511
swissspidy merged 3 commits intomainfrom
copilot/add-multiple-values-field-option

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

wp plugin list --name=plugin1,plugin2 was documented as possible via [-<field>=<value>] but --name=plugin1 --name=plugin2 (repeating args) silently reduced to the last value. Same issue affected --status when passed multiple times. Additionally, wp theme list --status=active,parent (comma-separated) returned an empty table instead of filtering by both statuses.

Changes

  • CommandWithUpgrade::_list: Handle array $field_filter values — when WP-CLI collects repeated args into an array (e.g. --name=a --name=b), the filter now correctly matches against all provided values instead of failing silently.
  • Plugin_Command / Theme_Command: Declare --status as repeating ([--status=<status>...]) to opt-in to WP-CLI's multi-value arg handling (see Add support for multiple flag values via repeated flags using ellipsis syntax wp-cli#6198), preventing the framework from collapsing --status=active --status=inactive to just inactive.
  • features/theme.feature: Added explicit test coverage for comma-separated --status=active,inactive in wp theme list, confirming the WP-CLI framework's comma-split validation and _list filtering both work correctly.

Usage

# Comma-separated (already worked for --name; now explicitly tested for --status)
wp plugin list --name=akismet,wordpress-importer
wp theme list --status=active,inactive
wp theme list --status=active,parent

# Repeating args (now works)
wp plugin list --name=akismet --name=wordpress-importer
wp plugin list --status=active --status=inactive
wp theme list --name=twentytwelve --name=twentyeleven
wp theme list --status=active --status=inactive
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow multiple values for --field options in wp plugin list</issue_title>
<issue_description>It's not possible to use multiple values in the --field option to customize wp plugin list.

For example, it would be helpful to be able to do the example command below:

wp plugin list --name=example-plugin1,example-plugin-2

This should only show the info for the plugins in the list, not all of the plugins.</issue_description>

<agent_instructions>This is now possible by passing the arg multiple times (opt-in), see wp-cli/wp-cli#6198 for details</agent_instructions>

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

@schlessera Correct, this is not possible. The main issue with a mechanism like that is the actual "user interface". If you use a comma for separating values, for example, you cannot have a comma in a value you're looking for anymore.

I wonder if the comma is actually useful in any of the fields here...?</comment_new>
<comment_new>@danielbachhuber
Related #224</comment_new>
<comment_new>@swissspidy
Related:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions github-actions bot added command:plugin-list Related to 'plugin list' command scope:testing Related to testing labels Mar 9, 2026
@swissspidy

This comment was marked as resolved.

…e list

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow multiple values for --field option in wp plugin list Allow multiple values for field filter options in wp plugin list and wp theme list Mar 9, 2026

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

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 swissspidy marked this pull request as ready for review March 10, 2026 04:06
@swissspidy swissspidy requested a review from a team as a code owner March 10, 2026 04:06
@swissspidy swissspidy added this to the 2.3.1 milestone Mar 10, 2026
@swissspidy swissspidy merged commit 2c9c943 into main Mar 10, 2026
63 checks passed
@swissspidy swissspidy deleted the copilot/add-multiple-values-field-option branch March 10, 2026 08:58
@swissspidy swissspidy linked an issue Mar 10, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp theme list show multiple status Allow multiple values for --field options in wp plugin list

3 participants