Directory / plugin

Hooktrail

v1.0.0 · by anu771063

See every hook that ran on a page, which plugin is behind it, how long it took, what it changed, and the queries and PHP warnings each plugin caused.

View on WordPress.org

About this plugin

When something on a WordPress site behaves strangely, the question is usually “which plugin is doing this?”. Hooktrail answers it for any page you open.

Switch it on for yourself, open a page, and choose Hooktrail in the admin bar. A panel opens at the bottom of the page.

Timeline

Every action and filter that fired, in order, grouped under WordPress’s loading stages. Each row shows when the hook first fired, how many times it ran, how long its first run took, and coloured tags for every plugin or theme with a callback on it. Click a row to see each callback, its priority and the exact file and line where it is defined.

Flame

A chart of hook run times: each bar is a hook’s first run, hooks fired inside it sit below it, and the slowest hooks are listed at the top. Click any bar to jump to that hook.

By plugin and Shared hooks

Every plugin, theme and WordPress core with the hooks it used on this page, and the hooks where more than one plugin or theme attaches a callback, listed in the order they run.

Trace

Pick a filter such as the_content or document_title_parts, reload, and see its value before and after every single callback, with the changed text highlighted. You see exactly which plugin changed what.

Queries

Every database query, with the hook that was running and the plugin or theme file, line and function that made it. Queries are totalled per plugin and repeated queries are grouped.

Assets

The theme template used for the page, the theme files loaded, and every script and stylesheet printed, with its size and the plugin, theme or external host that added it.

Issues

A short list of things worth a closer look: PHP warnings and notices with the plugin and hook that caused them, plugins on the same filter at the same priority, callbacks at extreme priorities, callbacks removed while the page loaded, repeated queries and slow hooks.

Not fired

Callbacks registered on hooks that did not run on this page, grouped by plugin.

Background

AJAX and REST API requests you made while recording (for example saves in the block editor), which never show a page of their own. Open any of them to see its full map.

Compare

Load two saved maps (for example before and after activating or updating a plugin) and see hooks, callbacks, priorities and assets that changed.

Also

  • Search across hooks, callbacks, files and queries.
  • Copy a plain-text summary of the page for a support ticket, or export the full map as JSON.
  • Translation, escaping, option, URL and query hooks, which fire hundreds of times per page, are hidden until you ask for them.
  • Plugin hook reference under Tools > Hooktrail: lists the actions and filters any installed plugin offers to other developers, read from its code (nothing is run), with a Markdown download.

WP-CLI

  • wp hooktrail record <url> [--output=<file>] records a page on this site as a logged-out visitor sees it.
  • wp hooktrail compare <a.json> <b.json> [--fail-on-change] compares two maps; with --fail-on-change it exits with status 1 when they differ, for deploy checks.
  • wp hooktrail hooks <plugin-folder> [--format=table|json|csv|markdown] lists the hooks a plugin offers.

Safe to leave installed

  • Recording only runs for administrators who switch it on for themselves, and only in their own browser. Visitors are never recorded and see nothing.
  • WP-CLI recording works only with a single-use token that can only be created from the command line, and records the page as a logged-out visitor.
  • Page maps live only in the page you are viewing. Background-request maps are kept for 30 minutes for your account only. Nothing else is stored.
  • No external services, no tracking.

Plugin tags