Implement wp site get command to enable site operations by URL#571
Merged
swissspidy merged 10 commits intomainfrom Feb 23, 2026
Merged
Implement wp site get command to enable site operations by URL#571swissspidy merged 10 commits intomainfrom
swissspidy merged 10 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
… reliability Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add option to delete site using --url
Implement wp site get command to enable site operations by URL
Feb 4, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
swissspidy
reviewed
Feb 5, 2026
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
swissspidy
approved these changes
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multisite installations with custom domains couldn't easily delete sites by URL - only by ID or slug, which required manual lookup in automated workflows.
Implementation
Adds
wp site get <site>command that accepts both site IDs and full URLs:URL detection and lookup
is_numeric()to distinguish between site IDs (numeric) and URLs/domains (non-numeric)http://wp_parse_url()to extract domain and pathget_blog_id_from_url()function for efficient lookups2http://example.com/site1/example.com/site1example.comsubdomain.example.comOutput formatting
WP_CLI\Formatterwith standard format optionsblog_id,url,last_updated,registeredsite_id,domain,path,public,archived,mature,spam,deleted,lang_id--fieldparameter for single field extractionCommand registration
composer.jsoncommands listUsage
Test Coverage
Added comprehensive Behat test scenarios covering:
All 32 test scenarios pass (372 steps).
Follows the pattern established by
wp user getandwp post getfor consistency with existing commands.Original prompt
💡 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.