WordPress
Hook & Filter Finder
Search WordPress action hooks and filter hooks across WordPress core.
WordPress Hook & Filter Finder — How to Use
WordPress hooks are the foundation of the plugin and theme API. Action hooks let you execute your own code at a specific point in the WordPress lifecycle — no return value needed. Filter hooks let you intercept a value, modify it, and return it back to WordPress.
Use this tool to quickly find the right hook by searching for keywords in the hook name or description, then filter by type (action vs filter) or execution phase. Each result includes a copy-ready code example.
Understanding Hook Phases
- Loading — Very early hooks that fire before themes or plugins are fully set up. Use for must-use plugin logic.
- Init — The
inithook is the most common place to register post types, taxonomies, shortcodes, and REST routes. - Admin — Hooks that fire only in the WordPress admin dashboard. Use for adding menus, settings pages, and admin assets.
- Frontend — Hooks that fire on public-facing pages. Use for enqueueing scripts, modifying the
<head>, or injecting content viawp_headandwp_footer. - Content — Filters on post content, title, and excerpt. Use these to append or modify displayed content.
- Loop — Hooks around the main query loop.
pre_get_postsis the correct hook to modify the main query before it runs. - Save — Hooks that fire when posts are created, updated, or deleted. Essential for meta box saving and cache invalidation.
- User — Hooks for user registration, login, and profile updates.
- REST — Hooks for the WordPress REST API. Use
rest_api_initto register custom endpoints.
Best Practices
- Always namespace your callback functions or use class methods to avoid naming conflicts.
- Use the
$priorityparameter (default: 10) to control execution order when multiple callbacks are attached to the same hook. - Always specify the
$accepted_argsparameter inadd_filter()if your callback needs more than one argument. - Remove hooks with
remove_action()/remove_filter()using the exact same priority and callback reference.