Visual hook finder Pro
Pro · This feature is part of Snipfire Pro. Plans
"Which hook do I need to put something there?" The hook finder answers it on your real site: every action is labelled right where it fires on the page, and one click creates a snippet on it.
Turn it on
- Open any page of your site while logged in.
- Click Hooks in the WordPress admin bar. (Or add
?snipfire-hooks=1to the page address.) - Click Hide hooks to turn it off again.
Only people who can edit snippets see it (administrators, and roles with CSS/JS/HTML or full team access). Visitors' pages are never touched: nothing is recorded unless you switch it on.
In the editor, the Custom hook… location links straight to it: Find hooks on your site →.
Reading the page
Every action that fires in the page body gets a small label where it fires, coloured by who fires it: WordPress, a plugin (WooCommerce, for example) or your theme. Labels on the page in the panel shows or hides them.
The Hooks on this page panel lists them in page order, in sections:
- On the page: actions with a position in the page.
- In the <head>: actions in the page's
<head>. - Before the page is output: actions that fire before any HTML, such as
initandtemplate_redirect(they have no position on the page). - Filters: the filters applied while building the page, and how often (applied 12× on this page).
Use the search box to find a hook by name. WordPress's internal plumbing (queries, caching, text domains, the admin bar and WooCommerce template-part hooks) is hidden until you tick Internal actions too. Minimise tucks the panel away.
Click a hook
The popover shows:
- the file that fires it, and how often it fired (fires 3×),
- what it passes: the real argument types seen on this page, for example Passes: WC_Product,
- its description, for WordPress core hooks and WooCommerce hooks,
- what's already attached, and at which priority: Already hooked here (4): pick a priority to go before or after them. For example, on a WooCommerce product page,
woocommerce_single_product_summaryhas the title at 5, the price at 10 and the add-to-cart button at 30, so priority 7 puts your snippet between the title and the price, - Snipfire snippets here: your snippets that already run on it.
And buttons:
- Add HTML here: opens the editor with a new HTML snippet on that hook.
- Add PHP on this hook: opens the editor with a new PHP snippet whose
add_action()callback is already written, with the arguments named. - Filter it with PHP (for filters): the same, with
add_filter()andreturn. - Copy name and Docs (the official reference, for core hooks).
Pick the priority in the new snippet, save, reload the page: your snippet is there.
Pick an element
No hook where you need one? Pick an element puts HTML before, after, inside or instead of any element on the page: open Hooks → Pick an element in the admin bar (or Pick an element in the panel), point at the element and click. See Next to an element and the element picker.
With the keyboard
The labels on the page open their popover with Enter or Space, and Esc closes it and puts focus back on the label. The element picker works with the arrow keys and Enter.
Good to know
- The hook finder shows actions where they fire. Filters don't have a position on the page, so they're listed with their counts instead.
- Pages are never cached while the hook finder is on.
- It works with classic themes (tested with Storefront) and block themes (tested with Twenty Twenty-Five), and doesn't change how the page renders. (Before 0.17, a theme whose
body_class()ran a database query could see the<body>tag's classes printed as text at the top of the page while the hook finder was on; that's fixed.) - Hook descriptions come from WordPress's and WooCommerce's own documentation (plus Snipfire's for WooCommerce template hooks it doesn't document) and are in English.
Something unclear or missing? Tell us