I'm trying to write a new plugin and I get so confused about wp hooks to use. What is the difference between init hook and admin_init hook, which one is fired first?
1 Answer
The init
hook is triggered a little earlier than the admin_init
. Between them is triggered wp_loaded
and few hooks related to updating the DB.
The init
hook fires when WP is finished loading (viewer-facing and administration side).
The admin_init
hook fires on administration side only (/wp-admin/*
), therefore is triggered also by front- and back-end ajax requests (/wp-admin/admin-ajax.php
) and POST handler (/wp-admin/admin-post.php
).
-
thanks for the help @nmr, I've found a comprehensive list of action hooks available in WordPress codex.wordpress.org/Plugin_API/Action_Reference Oct 17, 2020 at 18:08