Skip to content

fix(setup-wizard): use deterministic /network/ URL on multisite setup success#1158

Merged
superdav42 merged 2 commits intomainfrom
fix/multisite-wizard-network-redirect
May 8, 2026
Merged

fix(setup-wizard): use deterministic /network/ URL on multisite setup success#1158
superdav42 merged 2 commits intomainfrom
fix/multisite-wizard-network-redirect

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 7, 2026

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:

http://wordpress.local:8080/wp-admin/admin.php?page=wp-ultimo-setup

instead of the correct network admin URL:

http://wordpress.local:8080/wp-admin/network/admin.php?page=wp-ultimo-setup

Root cause

The button (in Multisite_Setup_Admin_Page::section_complete()) used wu_network_admin_url('wp-ultimo-setup'), which delegates to WordPress core's network_admin_url(). From wp-includes/link-template.php:

function network_admin_url( $path = '', $scheme = 'admin' ) {
    if ( ! is_multisite() ) {
        return admin_url( $path, $scheme );   // <-- falls back to single-site
    }
    ...
}

On this exact success view, is_multisite() returns 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 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 — replace wu_network_admin_url() call with deterministic site_url(...) plus an explanatory comment.
  • tests/WP_Ultimo/Admin_Pages/Multisite_Setup_Admin_Page_Test.php — add test_section_complete_continue_button_points_at_network_admin() asserting the button URL contains /network/admin.php and 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_completeOK (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)

  1. Install on a fresh single-site WordPress.
  2. Activate Ultimate Multisite.
  3. Run the multisite setup wizard to completion.
  4. Land on wp-admin/admin.php?page=wp-ultimo-multisite-setup&step=complete showing "Success! WordPress Multisite has been successfully enabled."
  5. Click "Continue to Multisite Ultimate Setup".
  6. Observe the URL is the wrong single-site form (/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

  • Bug Fixes
    • Fixed the "Continue to Multisite Ultimate Setup" button to ensure users are correctly redirected to the network admin panel instead of the single-site admin panel when completing the multisite setup process. This prevents navigation errors and allows users to proceed smoothly through the final setup steps.

… 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.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 88f60d7b-6910-45c3-afaf-847594c9233a

📥 Commits

Reviewing files that changed from the base of the PR and between 996589b and ed29862.

📒 Files selected for processing (2)
  • inc/admin-pages/class-multisite-setup-admin-page.php
  • tests/WP_Ultimo/Admin_Pages/Multisite_Setup_Admin_Page_Test.php

📝 Walkthrough

Walkthrough

The PR fixes the network admin URL routing in the multisite setup completion flow. The section_complete() method now uses a deterministic site_url() construction instead of a helper function for the "Continue" button destination, and a regression test validates that the button targets the network admin page.

Changes

Network Admin URL Routing

Layer / File(s) Summary
Core Implementation
inc/admin-pages/class-multisite-setup-admin-page.php
section_complete() computes the continue URL using site_url('wp-admin/network/admin.php?page=wp-ultimo-setup') for successful or existing multisite setups, replacing the previous wu_network_admin_url('wp-ultimo-setup') call.
Regression Test
tests/WP_Ultimo/Admin_Pages/Multisite_Setup_Admin_Page_Test.php
New test test_section_complete_continue_button_points_at_network_admin() verifies the button href points to the network admin URL and rejects the single-site admin URL form.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A hop, a skip, through admin routes we go,
From helper calls to URLs clean and straight,
The network path now shines with deterministic glow—
No detours to single-site, just network gate! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: using a deterministic network admin URL on multisite setup success instead of a potentially unreliable function-based URL.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/multisite-wizard-network-redirect

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@superdav42 superdav42 added bug Something isn't working origin:interactive Created by interactive user session labels May 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🔨 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!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

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: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 41 37.83 MB 881.00 ms (+31.00 ms / +4% ) 161.00 ms (+10.50 ms / +7% ) 1054.50 ms 2056.00 ms 1970.20 ms 87.05 ms (+4.25 ms / +5% )
1 56 49.12 MB 955.50 ms 142.50 ms (+3.50 ms / +2% ) 1100.50 ms (+24.00 ms / +2% ) 2092.00 ms (+42.00 ms / +2% ) 2012.45 ms 76.60 ms (-2.15 ms / -3% )

Comment thread inc/admin-pages/class-multisite-setup-admin-page.php Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🔨 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!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit b3c8f2b into main May 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working origin:interactive Created by interactive user session

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant