As per my understanding, functions attached to plugin_loaded and admin_init hooks are called whenever any admin page is loaded. What's the difference between them?
plugins_loaded fires once activated plugins have loaded. This fires on both admin and public screens.
admin_init fires as an admin screen or script is being initialized. This fires only on admin screens.
The typical order for firing of hooks on the admin screen is:
- muplugins_loaded - this is the first hook available to must-use plugins
- plugins_loaded - this is the first hook available to regular plugins
- after_setup_theme - this is the first hook available to themes
- wp_loaded - This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
- ... lots of other stuff
As you can see, a lot happens between
Hooks on the public side are similar to those above, with the notable absence of