Search for Resources and Solutions

Hooks Categories

An app, component, theme or plugin could have a big list with hooks. Will be affected the speed if them will be loaded every time when a page loads. For this reason i've invented the categories when i've created the load_hooks method in the apps, components, themes and plugins.

Every time when is called the load_hooks method is provided a category which tells to the code which hooks should be loaded. For frontend, user and administrator are loaded different hooks and this saves the speed.

The hooks categories have even a second goal. With them we can decide when a hook is used. For example the init hooks category is loaded every time when a page loads(is the first called category). In my apps, themes, components and plugins i'm adding functions when is called the init hooks categories. These functions are new pages registration and other features. In other categories i'm registering hooks to add content with the functions registered in the init hooks category.

Available hooks categories:

  • init - is the first category used in all pages.
  • user_init - is the category loaded when a user is logged in.
  • admin_init - is the category loaded when an admin is logged in.
  • frontend_init - is the category loaded for public.
  • plugins_init - is the last category used in all pages mainly for plugins.


With the hooks categories user_init, admin_init and frontend_init i'm using the code only when the is accessed the user panel, administrator panel or frontend pages.

The hooks categories are very important and them provides more independence to the apps, components, themes and plugins. We don't need to touch the core. 

Was this article helpful?