WordPress hooks for executing right before any action or page loading WordPress hooks for executing right before any action or page loading wordpress wordpress

WordPress hooks for executing right before any action or page loading


Last hook before loading the template is template_redirect

You can use it like this:

function my_function(){    // your code goes here}add_action( "template_redirect", "my_function" );


You can use 'init' hook. It will be performed before element or html code. It`s also useful to manage POST and GET variables. The syntax is something like this:

function yourfunction() {    dosomething();}add_action('init', yourfunction);


A list of all available hooks can be found here: https://codex.wordpress.org/Plugin_API/Action_Reference

Information about Hooks: https://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters

Other hooks must be suggested and will be added in a future release if is a good suggestion.Or you'd have to edit the core files ;)