WordPress captures to execute before loading any action or page loading

I am new to WP. The challenge is to develop a plugin for oauth authentication on one of the not popular openID providers. I did the same for the CodeIgniter project, but WP is a CMS, and for me it is a bit complicated. In Codeigniter, I check authorization before each action. In WP, I need a hook that I use for it ... before every page prints, or maybe it would be right to say before each action in terms of frameworks. What is this hook?

+8
php wordpress action hook
source share
4 answers

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

Hook info: https://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters

Other hooks should be offered and will be added in a future version if this is a good offer. Or you will have to edit the main files;)

0
source share

You can use the "init" hook. It will be executed before the element code or html. It is also useful to manage the POST and GET variables. The syntax looks something like this:

function yourfunction() { dosomething(); } add_action('init', yourfunction); 
+4
source share

Last hook before loading template template_redirect

You can use it as follows:

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

You mean the hook, when the whole wordpress function will be available, but before any output, including sent headers, is sent?

Attach your function well to init . This will trigger when you visit the site. If you want to use this hook only for the administration area, then this is admin_init .

0
source share

All Articles