wp-cli / entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.
MIT License
100 stars 89 forks source link

site create: allow custom domain configuration with subdomain based multisites #505

Open 35grain opened 2 months ago

35grain commented 2 months ago

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.