WordPress/wordpress-playground

Multisite mode

adamziel opened this issue · 3 comments

Description

Let's add an easy way to start Playground in a Multisite mode. Perhaps a predefined Blueprint triggered by ?multisite would do the trick? Like this one used to support gutenberg-pr:

function applyGutenbergPRSteps(prNumber: number): StepDefinition[] {

Technical steps

Multisite settings can be enabled using the following Blueprint:

{
    "landingPage":"/wp-admin/network.php",
    "steps": [
        { "step":"login" },
        {
           "step": "defineWpConfigConsts",
           "consts": {
                "WP_ALLOW_MULTISITE": true
           }
       }
    ]
}

Direct link

You still need to manually deactivate the importer plugin to be able to configure the network:

CleanShot 2023-06-02 at 15 25 19@2x

Once you do, WordPress asks you for the typical multisite setup:

CleanShot 2023-06-02 at 15 31 16@2x
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'playground.wordpress.net' );
define( 'PATH_CURRENT_SITE', '/scope:0.4195830517819887/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

These constants can be set using the "defineWpConfigConsts", except it's not straightforward for the scoped path.

#888 proposes a working enableMultisite Blueprint step.

This opens questions about the Blueprint format:

  • Should there be a createSite step now? Or is that better left to PHP?
  • Should steps like installPlugin now accept a siteId argument? We don't know the site ID upfront, though.

The enableMultisite step was merged in #888. I'll close this issue. Let's track any follow-up feature requests and fixes separately.