1. Early Initialization (Before Admin UI Loads)
These hooks fire before the admin interface is rendered:
muplugins_loaded– After must-use plugins load 12.plugins_loaded– After active plugins load (before admin checks) 213.auth_cookie_valid– After user authentication 2.set_current_user– Sets the current user object 2.init– Core initialization (register post types, taxonomies) 112.widgets_init– Fires atinitpriority 1 for sidebar registration 27.
admin_bar_init– Initializes the admin toolbar 26.wp_loaded– WordPress fully loaded (plugins, themes, user auth complete) 213.
2. Admin-Specific Setup
Hooks for admin dashboard initialization:
admin_init– Ideal for admin settings, enqueueing scripts/styles, or permissions checks 612.admin_menu– Adds top-level menus/submenus 613.network_admin_menu– For Multisite network admin menus 6.
current_screen– Detects which admin screen is loaded (e.g.,edit.php) 612.load-{$page_hook}– Runs before a specific admin page loads (e.g.,load-toplevel_page_my-plugin) 613.
3. Admin UI Rendering
Hooks during page rendering:
admin_enqueue_scripts– Proper place to enqueue admin JS/CSS 612.admin_head– Inside<head>of admin pages 612.admin_head-{$hook_suffix}– For specific admin pages 6.
admin_notices– Displays admin notices (e.g., success/error messages) 612.admin_print_scripts/admin_print_styles– Before scripts/styles are printed 6.in_admin_header– After admin toolbar, before content 6.admin_footer– Before closing</body>612.
4. Post/Page Editing
Hooks specific to post-editing screens:
add_meta_boxes– Register meta boxes for posts/pages 412.save_post– When a post is saved/updated 612.transition_post_status– When post status changes (e.g., draft → publish) 212.post_submitbox_misc_actions– Adds content to the publish meta box 6.
5. Late-Stage & Cleanup
shutdown– Final hook before PHP terminates (logs, cleanup) 513.wp_dashboard_setup– Customize the admin dashboard widgets 613.
Key Admin-Only Hooks Cheatsheet
| Hook | Purpose | Example Use Case |
|---|---|---|
admin_init | Initialize admin settings | Register plugin options |
admin_menu | Add admin menus | Create a custom plugin page |
admin_enqueue_scripts | Load admin JS/CSS | Add a datepicker to a meta box |
current_screen | Target specific admin screens | Run code only on edit.php |
save_post | Post save/update | Sync data to external API |
admin_notices | Show alerts | “Settings saved” notification |
Pro Tips
- Conditional Loading: Use
is_admin()or$pagenowchecks to target specific admin areas 13. - AJAX Handling: Use
wp_ajax_{action}for logged-in users andwp_ajax_nopriv_{action}for guests 612. - Custom Hooks: Create extensible plugins with
do_action('my_plugin_hook')512.