A WordPress hook is a designated point in WordPress core, plugin, or theme code where developers can attach custom functions to modify behavior or inject new functionality - without editing the original source files. Hooks are the foundation of WordPress extensibility, and they are what makes the entire plugin and theme ecosystem possible.
WordPress provides two distinct types of hooks: actions and filters. Understanding the difference between them is essential for anyone working with WordPress development.
Actions
An action hook fires at a specific moment during WordPress execution - for example, when a page loads, when a post is saved, or when the admin dashboard initializes. Developers use the add_action() function to attach a custom function (called a callback) to an action. When WordPress reaches that point in its execution, it runs every callback registered to that action. Actions are used to do something - such as sending an email, enqueuing a stylesheet, or inserting content into a page.
Filters
A filter hook intercepts a piece of data before it is used or displayed, allowing developers to modify it and return the altered version. Filters are attached using the add_filter() function. For instance, the the_content filter passes the body of a post through any registered callbacks before rendering it on screen. A plugin might use this to append a sharing widget or transform certain shortcodes. Unlike actions, filters always receive a value and must always return one.
Why Hooks Matter
The hook system solves a critical problem in software maintenance: how to customize a platform without modifying its core files. If a developer were to edit WordPress core directly, those changes would be overwritten every time WordPress updates. By relying on hooks instead, customizations live entirely within a plugin or a child theme, and they survive updates cleanly.
This architecture also means that multiple plugins can each attach their own callbacks to the same hook, and WordPress will execute them all - in order of a configurable priority value. This composability is what allows thousands of independent plugins to coexist on a single WordPress installation without conflicting with core behavior.
Hooks are also used extensively by theme developers. Template hooks such as wp_head and wp_footer allow plugins to inject scripts or metadata into a page's HTML without the theme needing to explicitly support each plugin. This separation of concerns keeps WordPress codebases modular, maintainable, and upgrade-safe.
For anyone building or customizing a WordPress site beyond the basics, hooks are the primary tool for doing so responsibly and sustainably.