Skip to content

feat: hook timings, the bar in wp-admin, multisite (phase 3) - #3

Merged
ogorzalka merged 3 commits into
developfrom
feat/phase-3
Oct 8, 2026
Merged

ogorzalka merged 3 commits into
developfrom
feat/phase-3

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Phase 3 of the debug bar integration, stacked on #2 (retarget to develop before deleting feat/phase-2).

  • WP Hook timings (opt-in, options.wp_hooks.timings): at each all call, the hook's callbacks not timed yet are wrapped in place in $wp_filter, under their own key, so remove_action(), has_filter() and re-adds keep working (WP_Hook is final). Own time and total, slowest first, capped by timings_limit. Callbacks with by-reference parameters and the package's own are left alone; array callbacks stay readable as [0]/[1].
  • wp-admin: wp-config.php boots providers without a kernel, so Debugbar never shows there. The bar is printed with admin_print_footer_scripts and stored, without Debugbar's Laravel-only tabs (route, views, session, livewire, inertia; admin.hidden_collectors). The REST calls of the block editor are listed in it. Off with DEBUGBAR_POLLORA_ADMIN=false.
  • WP Request: admin page, hook suffix and screen; on a multisite, the site that answered, the network, every switch_blog with its component, and a warning when the request ends still switched.
  • Hooks tab: a closure is named after a class only when written in that class's file (mu-plugins were shown as closures of Pollora's Bootstrap).

Checked on the scratch site: dashboard, post editor and Site Editor show the bar; 200 callbacks timed; multisite (converted, then restored) shows the switches and the unrestored one. Overhead of timings not measurable against run-to-run noise (median of 15, two runs); +26 KB on the front page.

Tests: 97 Pest tests, PHPStan, Pint; E2E 12 tests locally (2 new: admin page, editor REST call).

- WP Hook timings tab (opt-in, options.wp_hooks.timings): each callback
  wrapped in place in $wp_filter under its own key, own and total time,
  slowest first; by-reference callbacks left alone
- wp-admin: the bar printed with the admin footer scripts and stored,
  without Debugbar's Laravel-only tabs; the block editor's REST calls
  are listed in it
- WP Request: admin page and screen; on a multisite, the site, the
  network, every site switch and a switch never restored
- Hooks: a closure is named after a class only when written in it
The request is still stored; set DEBUGBAR_POLLORA_IFRAMES=true to print
the bar in frames too.
@ogorzalka
ogorzalka changed the base branch from feat/phase-2 to develop October 8, 2026 16:25
@ogorzalka
ogorzalka merged commit f20ff3a into develop Oct 8, 2026
4 checks passed
@ogorzalka
ogorzalka deleted the feat/phase-3 branch October 8, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant