Skip to content

feat: add WordPress multisite (subdirectory) network support#75

Merged
PAMulligan merged 1 commit into
mainfrom
23-add-wordpress-multisite-network-support
May 20, 2026
Merged

feat: add WordPress multisite (subdirectory) network support#75
PAMulligan merged 1 commit into
mainfrom
23-add-wordpress-multisite-network-support

Conversation

@PAMulligan
Copy link
Copy Markdown
Collaborator

Closes #23.

Summary

  • Adds an opt-in multisite compose profile that converts the single-site install into a subdirectory multisite network, patches the network constants via wp config set, replaces .htaccess, optionally creates a sample sub-site, and promotes user 1 to super admin
  • Adds mu-plugins/flavian-multisite.php: cached get_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.
  • Extends wp-environment-manager agent with a § 8 covering site CRUD, super admins, network-wide activation, multisite-aware code patterns, and a troubleshooting table
  • Adds docs/multisite/README.md covering setup, day-to-day site operations, and a "why subdomain mode isn't shipped" section

Subdomain 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 environment supports multisite configuration (docker compose --profile multisite up multisite-installer)
  • Theme scaffold includes multisite-compatible templates — handled via the mu-plugins/flavian-multisite.php helpers (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-plugin
  • Agents handle multisite operations correctly (wp-environment-manager agent updated)

Test plan

  • Fresh stack: docker compose up -d then docker compose --profile multisite up multisite-installer → completes without error and prints the network URLs
  • docker compose exec wordpress wp site list --allow-root returns 2 rows (main + site2)
  • http://localhost:8080/wp-admin/network/ renders the network dashboard with the new "Network sites" widget
  • http://localhost:8080/site2/ returns a 200 (sub-site reachable)
  • Re-running the installer detects an existing network and bails out cleanly
  • docker compose exec wordpress wp super-admin list --allow-root includes user 1
  • docker 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)
  • Disable multisite by removing the constants from wp-config.php → mu-plugin early-returns, no fatals

🤖 Generated with Claude Code

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>
@PAMulligan PAMulligan linked an issue May 20, 2026 that may be closed by this pull request
3 tasks
@PAMulligan PAMulligan self-assigned this May 20, 2026
@PAMulligan PAMulligan added enhancement New feature or request pipeline Figma/Canva-to-WordPress conversion pipeline code quality Code quality improvements labels May 20, 2026
@PAMulligan PAMulligan moved this from Todo to Done in PMDS Open Source Roadmap May 20, 2026
@PAMulligan PAMulligan added this to the v2.0.0 milestone May 20, 2026
@PAMulligan PAMulligan merged commit 9b354f1 into main May 20, 2026
9 checks passed
@PAMulligan PAMulligan deleted the 23-add-wordpress-multisite-network-support branch May 20, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code quality Code quality improvements enhancement New feature or request pipeline Figma/Canva-to-WordPress conversion pipeline

Projects

Development

Successfully merging this pull request may close these issues.

Add WordPress multisite network support

1 participant