Skip to content

Implement wp site get command to enable site operations by URL#571

Open
Copilot wants to merge 8 commits intomainfrom
copilot/allow-delete-site-with-url
Open

Implement wp site get command to enable site operations by URL#571
Copilot wants to merge 8 commits intomainfrom
copilot/allow-delete-site-with-url

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

  • Understand existing codebase and site command structure
  • Implement wp site get command that accepts site ID or URL
  • Add support for fetching site by URL (domain/path lookup)
  • Add proper field formatting with WP_CLI\Formatter
  • Create Behat tests for the new command
  • Test the command with various scenarios (ID, URL, field output)
  • Update documentation with usage examples
  • Run code quality checks (lint, phpcs, phpstan)
  • Verify all site.feature tests pass
  • Address code review feedback (refactor field casting, improve test reliability)
  • Use WordPress's cached get_blog_id_from_url() function for URL lookups
Original prompt

This section details on the original issue you should resolve

<issue_title>site delete: allow deleting a site with the --url option</issue_title>
<issue_description>## Feature Request

Describe your use case and the problem you are facing

Currently the blog ID or slug must be specified when using the command. In cases where a custom domain is used, however, the --slug option fails and it is tedious to look up the assigned site ID in an automated use case.

Describe the solution you'd like

Allow site deletion by only specifying the --url option. For example: wp site delete --url="http://example.com".
</issue_description>

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

@swissspidy We could implement `wp site get ` instead, then one could pair `wp site delete` with `wp site get http://example.com --field=id`. This would be more in line with all the other commands.

💡 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.

@github-actions github-actions bot added command:network-meta-delete Related to 'network meta delete' command command:network-meta-get Related to 'network meta get' command command:network Related to 'network' command labels Feb 4, 2026
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Site_Command.php 87.09% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI and others added 4 commits February 4, 2026 16:34
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
Copilot AI requested a review from swissspidy February 4, 2026 16:56
@swissspidy swissspidy requested a review from Copilot February 4, 2026 19:07

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swissspidy swissspidy marked this pull request as ready for review February 5, 2026 06:28
@swissspidy swissspidy requested a review from a team as a code owner February 5, 2026 06:28
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:network Related to 'network' command command:network-meta-delete Related to 'network meta delete' command command:network-meta-get Related to 'network meta get' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

site delete: allow deleting a site with the --url option

2 participants