Skip to content

Add --inactive flag to wp sidebar list and wp widget reset#75

Merged
swissspidy merged 6 commits intomainfrom
copilot/list-inactive-sidebars-widgets
Mar 17, 2026
Merged

Add --inactive flag to wp sidebar list and wp widget reset#75
swissspidy merged 6 commits intomainfrom
copilot/list-inactive-sidebars-widgets

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

  • Explore codebase and understand implementation
  • Add --inactive flag to wp sidebar list to list unregistered/orphaned sidebars
  • Add --inactive flag to wp widget reset to reset all unregistered sidebars
  • Fix wp_inactive_widgets exclusion bug in wp widget reset
  • Update error message for wp widget reset with no args to mention --inactive
  • Add Behat test for wp sidebar list --inactive
  • Add Behat test for wp widget reset --inactive
  • Refactor: move get_inactive_sidebar_ids() to Sidebar_Command as public static method; remove duplicate from Widget_Command
  • Run lint, phpcs, phpstan — all pass
Original prompt

This section details on the original issue you should resolve

<issue_title>List all inactive sidebars on a site.</issue_title>
<issue_description>Background: We have a network of sites that did some crazy things in the past and now have hundreds of inactive sidebars each filled with a dozen or more widgets.

Desired functionality: We would like to remove all widgets in inactive sidebars via cli. I considered writing a custom cli to do this, but I thought that this might be a common enough problem to warrant adding to the wp widget or wp sidebar commands.

Questions:
Is this something that would be worth adding?
How should this be added?

Possible solutions: (please adjust as needed)
$ wp widget reset (wp sidebar list --filter=inactive )
or
$ wp widget reset (wp sidebar list --inactive )
or
$ wp widget reset --inactive
or
$ wp widget reset --all-inactive
</issue_description>

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

@danielbachhuber This seems like a reasonable improvement! I don't have any strong opinions on the implementation; I'd need to refresh myself on the widget internals.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@github-actions github-actions bot added command:sidebar-list Related to 'sidebar list' command command:widget-reset Related to 'widget reset' command scope:distribution Related to distribution state:unconfirmed labels Mar 17, 2026
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Sidebar_Command.php 96.66% 1 Missing ⚠️
src/Widget_Command.php 95.83% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to remove all widgets in inactive sidebars Add --inactive flag to wp sidebar list and wp widget reset Mar 17, 2026
Copilot AI requested a review from swissspidy March 17, 2026 10:13
@swissspidy swissspidy marked this pull request as ready for review March 17, 2026 11:28
@swissspidy swissspidy requested a review from a team as a code owner March 17, 2026 11:28
Copilot AI review requested due to automatic review settings March 17, 2026 11:28

This comment was marked as resolved.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This comment was marked as resolved.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

… public static method

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy March 17, 2026 12:13
@swissspidy swissspidy merged commit 67bb805 into main Mar 17, 2026
59 checks passed
@swissspidy swissspidy deleted the copilot/list-inactive-sidebars-widgets branch March 17, 2026 12:27
@swissspidy swissspidy added this to the 2.2.1 milestone Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:sidebar-list Related to 'sidebar list' command command:widget-reset Related to 'widget reset' command scope:distribution Related to distribution state:unconfirmed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List all inactive sidebars on a site.

3 participants