WordPress at Your Fingertips

WordPress Hooks Order (How They are Triggered)

Actions (hooks) are triggered not at the same time in WordPress, but in a certain sequence (one by one). The order is determined by the occurrence of an action in PHP code. To write code correctly, you need to understand in what order hooks are executed. See below such order for popular actions of WordPress core.

Front actions

mu_plugin_loaded
network_plugin_loaded
muplugins_loaded
registered_taxonomy
registered_post_type
plugin_loaded
plugins_loaded
sanitize_comment_cookies
setup_theme
load_textdomain
after_setup_theme
auth_cookie_malformed
auth_cookie_valid
set_current_user
init
widgets_init
register_sidebar
wp_register_sidebar_widget
wp_default_scripts
wp_default_styles
admin_bar_init
add_admin_bar_menus
wp_loaded
parse_request
send_headers
parse_query
pre_get_posts
posts_clauses
posts_selection
wp
template_redirect

Theme template file {

}

shutdown

Admin actions

mu_plugin_loaded
network_plugin_loaded
muplugins_loaded
registered_taxonomy
registered_post_type
plugin_loaded
plugins_loaded
sanitize_comment_cookies
setup_theme
load_textdomain
after_setup_theme
load_textdomain
auth_cookie_valid
set_current_user
init
widgets_init
register_sidebar
wp_register_sidebar_widget
wp_default_scripts
wp_default_styles
admin_bar_init
add_admin_bar_menus
wp_loaded
auth_cookie_valid
auth_redirect
_admin_menu
admin_menu
admin_init
current_screen
load-(page_hook)

If there is a wp query on the page (posts page) {

}

admin_title
admin_xml_ns
admin_enqueue_scripts
admin_print_styles-(hook_suffix)
admin_print_styles
admin_print_scripts-(hook_suffix)
admin_print_scripts
wp_print_scripts
admin_head-(hook_suffix)
admin_head
adminmenu
in_admin_header
admin_notices
all_admin_notices
(hook)
restrict_manage_posts
the_post
pre_user_query
in_admin_footer
admin_footer
admin_bar_menu
wp_before_admin_bar_render
wp_after_admin_bar_render
admin_print_footer_scripts-(hook_suffix)
admin_print_footer_scripts
admin_footer-(hook_suffix)
shutdown
wp_dashboard_setup