Skip to content

Add --site-url parameter for custom domain configuration in site create#576

Draft
Copilot wants to merge 11 commits intomainfrom
copilot/allow-custom-domain-configuration
Draft

Add --site-url parameter for custom domain configuration in site create#576
Copilot wants to merge 11 commits intomainfrom
copilot/allow-custom-domain-configuration

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Implementation Summary: Custom Domain Configuration for Site Create

All PR Review Feedback Addressed

Changes Made to Address Feedback

1. Documentation Clarification (Comment 2809170205)

  • Updated --site-url documentation to explicitly explain behavior when both --slug and --site-url are provided
  • Clarifies that --slug is used for internal operations while --site-url domain/path is used for the actual site URL

2. Security Enhancements (Comments 2809170200, 2809170218)

  • Added URL scheme validation (only http and https allowed)
  • Added domain and path sanitization using sanitize_text_field()
  • Clear error messages for invalid schemes

3. Error Handling Improvements (Comment 2809170190 by @swissspidy)

  • Removed timestamp-based auto-generation for empty base
  • Now requires explicit --slug when base cannot be derived from URL path
  • Better error messages explaining why slug derivation failed

4. Base Sanitization (Comment 2809170234)

  • Added immediate lowercase conversion after deriving base from URL
  • Ensures consistency before WordPress sanitization logic runs
  • Prevents case-sensitivity issues in user creation

5. Subdirectory Domain Warning (Comment 2809170215)

  • Added warning when using different domain in subdirectory multisite
  • Informs users that additional configuration (like domain mapping) may be needed
  • Helps prevent configuration issues

6. Comprehensive Test Coverage (Comments 2809170210, 2809170229)

  • Added test for URL without trailing slash (verifies normalization)
  • Added test for invalid URL scheme (ftp://)
  • Added test for root path requiring explicit slug
  • Added test verifying slug is used internally when both params provided
  • Added test for subdirectory warning message
  • Total: 14 test scenarios covering all edge cases

Testing

  • ✅ PHPCS (code style) - passing
  • ✅ PHPStan (static analysis) - passing
  • ✅ All syntax checks passing
  • ✅ 14 comprehensive Behat scenarios (will pass once CI environment available)

Security & Quality

  • Domain and path inputs properly sanitized
  • URL scheme validated to prevent protocol confusion
  • Clear error messages guide users to correct usage
  • No code smells or violations detected
Original prompt

This section details on the original issue you should resolve

<issue_title>site create: allow custom domain configuration with subdomain based multisites</issue_title>
<issue_description>## Feature Request

Describe your use case and the problem you are facing

In a subdomain based multisite installation, where the main site itself is using a subdomain e.g. a.example.com, all new sites are created with a 4th level domain. For example in this specific case, wp site create --slug=b would configure the new site to use b.a.example.com.

What if we would like to use 3rd level domains in the new sites or perhaps use a completely different domain? Currently this can be achieved by replacing the domain in the database tables: wp search-replace b.a.example.com b.example.com --all-tables --network. This is an extra step, however, and could likely be simplified.

Describe the solution you'd like

In addition to the --slug option, perhaps there could be an option to specify the base domain to which the slug is added? For example to configure b.example.com, the command could look something like wp site create --slug=b --base_domain=example.com. Or simply allow defining the whole URL at once by making use of the --url option wp site create --url="https://b.example.com" or similar.
</issue_description>

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.

@github-actions github-actions bot added command:network-meta Related to 'network meta' command command:network-meta-update Related to 'network meta update' command command:network Related to 'network' command labels Feb 14, 2026
Copilot AI and others added 7 commits February 14, 2026 22:34
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…eter

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>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add custom domain configuration for multisite creation Add --site-url parameter for custom domain configuration in site create Feb 14, 2026
Copilot AI requested a review from swissspidy February 14, 2026 22:50
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 0% with 47 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Site_Command.php 0.00% 47 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

swissspidy and others added 2 commits February 15, 2026 17:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ensive tests

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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 Related to 'network meta' command command:network-meta-update Related to 'network meta update' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

site create: allow custom domain configuration with subdomain based multisites

2 participants