Bug
Uncaught ReferenceError: wu_tours is not defined
at HTMLDocument.<anonymous> (tours.js:7:10)
The guided tour on the network admin dashboard (/wp-admin/network/) throws a ReferenceError because wu_tours is never defined.
Root Cause
tours.js line 7 calls _.each(wu_tours, ...) unconditionally. The wu_tours variable is localized onto the wu-admin script handle (wp_localize_script('wu-admin', 'wu_tours', ...) in Tours::enqueue_scripts() line 95).
Since PR #433 (cb5a40fd — "Scope admin asset enqueues to WP Ultimo pages only"), wu-admin is only enqueued on pages where wu_is_wu_page() returns true. The network dashboard (index.php, hook suffix dashboard-network) is not a WU page, so wu-admin is never enqueued there and wu_tours is never defined.
The code comment on line 94 says "wu-admin which will always be there" — this assumption was broken by the performance scoping change.
Affected Pages
- Network admin dashboard (
/wp-admin/network/) — Dashboard_Widgets::register_network_widgets() creates a "dashboard" tour at line 104
Other pages that create tours (class-dashboard-admin-page.php, class-product-edit-admin-page.php, etc.) are WU pages where wu-admin IS enqueued, so they're unaffected.
Fix Options
-
In Tours::enqueue_scripts(): Instead of localizing onto wu-admin, enqueue a lightweight carrier script (or use wp_add_inline_script on underscore) to define wu_tours and wu_tours_vars as globals. This decouples tours from wu-admin.
-
In tours.js: Add a guard if (typeof wu_tours === 'undefined') return; before the _.each call. This prevents the error but means tours silently won't work if the localization is missing — the underlying localization issue still needs fixing.
-
In Dashboard_Widgets::enqueue_scripts(): Explicitly enqueue wu-admin on the dashboard (like was done for wu-functions). This is the simplest fix but re-loads wu-admin on a non-WU page, partially undoing the performance optimization.
Option 1 is the cleanest — it fixes the architectural issue (tours shouldn't depend on wu-admin being present).
Related
aidevops.sh v3.5.463 plugin for OpenCode v1.3.4 with claude-opus-4-6 spent 1h 5m and 22,392 tokens on this with the user in an interactive session.
Bug
The guided tour on the network admin dashboard (
/wp-admin/network/) throws aReferenceErrorbecausewu_toursis never defined.Root Cause
tours.jsline 7 calls_.each(wu_tours, ...)unconditionally. Thewu_toursvariable is localized onto thewu-adminscript handle (wp_localize_script('wu-admin', 'wu_tours', ...)inTours::enqueue_scripts()line 95).Since PR #433 (
cb5a40fd— "Scope admin asset enqueues to WP Ultimo pages only"),wu-adminis only enqueued on pages wherewu_is_wu_page()returns true. The network dashboard (index.php, hook suffixdashboard-network) is not a WU page, sowu-adminis never enqueued there andwu_toursis never defined.The code comment on line 94 says "wu-admin which will always be there" — this assumption was broken by the performance scoping change.
Affected Pages
/wp-admin/network/) —Dashboard_Widgets::register_network_widgets()creates a "dashboard" tour at line 104Other pages that create tours (
class-dashboard-admin-page.php,class-product-edit-admin-page.php, etc.) are WU pages wherewu-adminIS enqueued, so they're unaffected.Fix Options
In
Tours::enqueue_scripts(): Instead of localizing ontowu-admin, enqueue a lightweight carrier script (or usewp_add_inline_scriptonunderscore) to definewu_toursandwu_tours_varsas globals. This decouples tours fromwu-admin.In
tours.js: Add a guardif (typeof wu_tours === 'undefined') return;before the_.eachcall. This prevents the error but means tours silently won't work if the localization is missing — the underlying localization issue still needs fixing.In
Dashboard_Widgets::enqueue_scripts(): Explicitly enqueuewu-adminon the dashboard (like was done forwu-functions). This is the simplest fix but re-loadswu-adminon a non-WU page, partially undoing the performance optimization.Option 1 is the cleanest — it fixes the architectural issue (tours shouldn't depend on
wu-adminbeing present).Related
wu_moment/activity-stream.jscb5a40fd)aidevops.sh v3.5.463 plugin for OpenCode v1.3.4 with claude-opus-4-6 spent 1h 5m and 22,392 tokens on this with the user in an interactive session.