feat: add WordPress multisite (subdirectory) network support#75
Merged
Conversation
Closes #23. Ships multisite as an opt-in compose profile alongside the existing single-site setup — `docker compose --profile multisite up multisite-installer` converts the install into a subdirectory network, writes the network constants via `wp config set`, replaces .htaccess, and creates a sample second site. Subdomain mode is deliberately not wired up: it needs wildcard DNS that doesn't work generically in Docker. The script refuses to silently produce a broken setup; docs/multisite/README.md documents the manual flip with the wildcard-DNS caveats called out. The mu-plugin (`mu-plugins/flavian-multisite.php`) early-returns on single-site installs, so it's safe to leave in place. When multisite is active it adds a cached `get_sites()` helper, a network admin dashboard widget, a per-site notice surfacing the network to super admins, and a `[flavian_network_sites]` shortcode for cross-site nav. Agent layer: `wp-environment-manager` gains a § 8 covering site CRUD, super admin management, network-wide activation, multisite-aware code patterns, and a troubleshooting table. No new agent name to keep multisite ops as a single source of truth. PHPCS verified against `WordPress-Extra,WordPress-Docs` (1 file, 0 errors after a phpcbf pass for `=>` alignment). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
Closes #23.
Summary
multisitecompose profile that converts the single-site install into a subdirectory multisite network, patches the network constants viawp config set, replaces.htaccess, optionally creates a sample sub-site, and promotes user 1 to super adminmu-plugins/flavian-multisite.php: cachedget_sites()helper, network admin dashboard widget, per-site notice surfacing the network to super admins, and a[flavian_network_sites]shortcode. Early-returns on single-site installs.wp-environment-manageragent with a § 8 covering site CRUD, super admins, network-wide activation, multisite-aware code patterns, and a troubleshooting tabledocs/multisite/README.mdcovering setup, day-to-day site operations, and a "why subdomain mode isn't shipped" sectionSubdomain mode is deliberately deferred — it needs wildcard DNS that doesn't work generically in Docker (
*.localhost, dnsmasq, or per-site hosts entries). The docs spell out how to flip to subdomain mode manually if needed.Acceptance criteria
docker compose --profile multisite up multisite-installer)mu-plugins/flavian-multisite.phphelpers (cached site list, dashboard widget, shortcode). Themes don't need changes because WP themes are multisite-compatible by default; cross-site UI is provided by the mu-pluginwp-environment-manageragent updated)Test plan
docker compose up -dthendocker compose --profile multisite up multisite-installer→ completes without error and prints the network URLsdocker compose exec wordpress wp site list --allow-rootreturns 2 rows (main + site2)http://localhost:8080/wp-admin/network/renders the network dashboard with the new "Network sites" widgethttp://localhost:8080/site2/returns a 200 (sub-site reachable)docker compose exec wordpress wp super-admin list --allow-rootincludes user 1docker run --rm -v "$(pwd):/work" -w /work php:8.3-cli php ./vendor/bin/phpcs --standard=WordPress-Extra,WordPress-Docs --extensions=php --ignore=*/index.php mu-plugins/returns exit 0 (already verified locally — 2 files, 0 errors)🤖 Generated with Claude Code