fix(setup-wizard): use deterministic /network/ URL on multisite setup success#1158
fix(setup-wizard): use deterministic /network/ URL on multisite setup success#1158superdav42 wants to merge 2 commits intomainfrom
Conversation
… success
After completing the multisite setup wizard, the 'Continue to Multisite
Ultimate Setup' button on the success page linked to the single-site
admin URL (/wp-admin/admin.php?page=wp-ultimo-setup) instead of the
network admin URL (/wp-admin/network/admin.php?page=wp-ultimo-setup).
Root cause: the button used wu_network_admin_url('wp-ultimo-setup'),
which delegates to WordPress core's network_admin_url(). That function
falls back to admin_url() whenever is_multisite() returns false — and
on this exact view is_multisite() is false whenever OPcache is still
serving a stale wp-config.php that hasn't yet picked up the freshly
written MULTISITE constant. The file's own docblock at lines 314-321
already documents this stale-OPcache scenario.
Fix: build the URL deterministically with site_url(). site_url() returns
the install root regardless of multisite state, and on a just-enabled
multisite the install root is the network main-site URL — so the
composed /wp-admin/network/admin.php?page=wp-ultimo-setup path is
correct in every case.
Adds a regression test asserting the success-view button URL contains
/network/admin.php and does not contain the single-site form.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR fixes the network admin URL routing in the multisite setup completion flow. The ChangesNetwork Admin URL Routing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 3f73b2f are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
Summary
Fix the multisite setup wizard success-page button so it always points at the network admin URL, not the single-site admin URL.
The bug
After completing the multisite setup wizard, the "Continue to Multisite Ultimate Setup" button on the success page linked to:
instead of the correct network admin URL:
Root cause
The button (in
Multisite_Setup_Admin_Page::section_complete()) usedwu_network_admin_url('wp-ultimo-setup'), which delegates to WordPress core'snetwork_admin_url(). Fromwp-includes/link-template.php:On this exact success view,
is_multisite()returnsfalsewhenever OPcache is still serving a stalewp-config.phpthat hasn't yet picked up the freshly writtenMULTISITEconstant. The file's own docblock at lines 314-321 already documents this stale-OPcache scenario for the redirect path — the same scenario also poisons the button URL.The fix
Build the URL deterministically with
site_url('wp-admin/network/admin.php?page=wp-ultimo-setup').site_url()returns the install root regardless of multisite state, and on a just-enabled multisite the install root is the network main-site URL — so the composed path is correct in every case.Files changed
inc/admin-pages/class-multisite-setup-admin-page.php— replacewu_network_admin_url()call with deterministicsite_url(...)plus an explanatory comment.tests/WP_Ultimo/Admin_Pages/Multisite_Setup_Admin_Page_Test.php— addtest_section_complete_continue_button_points_at_network_admin()asserting the button URL contains/network/admin.phpand does not contain the single-site form.Verification
php -l— no syntax errors.vendor/bin/phpcs— no new violations introduced (only pre-existing text-domain-mismatch warnings unrelated to this change).vendor/bin/phpstan analyse inc/admin-pages/class-multisite-setup-admin-page.php—[OK] No errors.vendor/bin/phpunit --filter test_section_complete—OK (4 tests, 7 assertions), including the new regression test.vendor/bin/phpunit --filter Multisite_Setup_Admin_Page_Test— exit 0 (full class suite still passes).How to reproduce (before this fix)
wp-admin/admin.php?page=wp-ultimo-multisite-setup&step=completeshowing "Success! WordPress Multisite has been successfully enabled."/wp-admin/admin.php?page=wp-ultimo-setup) instead of the network form (/wp-admin/network/admin.php?page=wp-ultimo-setup).After this fix the button always lands on the
/network/URL.aidevops.sh v3.14.91 plugin for OpenCode v1.14.40 with gemma4:e4b spent 15h 12m and 263,673 tokens on this with the user in an interactive session.
Summary by CodeRabbit