View Categories

Glossary: WordPress Hooks, Actions, and Filters

3 min read

Why these terms appear in Loupely captures #

When Loupely captures a diagnostic session, the Hook Execution layer records which WordPress hooks fired, in what order, and whether any of them failed or produced errors. If you see references to hook names, actions, or filters in your diagnosis output or capture file, this glossary explains what those terms mean.

What a hook is #

WordPress is built around a system that lets plugins and themes attach their own code to specific points in WordPress’s execution. Those attachment points are called hooks. A hook is a named event in the WordPress codebase that says: “at this moment in the page load, any code that has registered to run here will run now.” The WordPress Core code, your theme, and every active plugin all use hooks to communicate and interact with each other without directly modifying one another’s code.

When something breaks in WordPress, it often breaks at a hook: either a hook that was supposed to fire didn’t, a hook fired in the wrong order, or code attached to a hook threw an error. This is why Loupely records Hook Execution as part of the diagnostic layer.

Actions #

An action is a type of hook that says “do something at this point.” When WordPress reaches an action hook, all the functions that have registered with that hook run in sequence. They don’t return a value. They just run. Common examples: wp_enqueue_scripts (the point where themes and plugins register their JavaScript and CSS files), init (very early in WordPress loading, where many plugins initialize themselves), save_post (fires whenever a post is saved to the database).

In a Loupely capture, if save_post fired but your data didn’t save, the Hook Execution log tells you whether the action completed normally or whether a function attached to it threw an error partway through.

Filters #

A filter is a type of hook that says “modify this data as it passes through.” Unlike actions, filters receive a value, do something to it, and return the modified value. If you have 3 plugins all filtering the same piece of data, they run in sequence, each receiving the output of the one before it. Common example: the_content, which every plugin that modifies post content (adding footnotes, shortcodes, social share buttons) hooks into.

A filter that doesn’t return a value properly can silently break things. Loupely’s Hook Execution capture records whether filter functions returned expected values or whether the chain was interrupted.

Hook Execution order #

Multiple functions can attach to the same hook. Each gets a priority number (default is 10). Lower numbers run first. If 2 plugins both hook into woocommerce_checkout_process at priority 10, they run in the order they were attached. If there’s a conflict between them (one expects data the other removed), the problem shows up at that hook in the execution chain. Loupely records this sequence, which is what allows the correlation rules to identify which hook in the chain was the failure point.