I’m quite new to WP. Task is to develop a plugin for oauth authentication on one of not popular openID providers. I did the same for CodeIgniter project, but WP is a CMS and is little bit complex for me to understand. In Codeigniter i check authorisation before each action. In WP i need a hook which uses for it… before each page printing, or maybe.. it would be right to say before each action in terms of frameworks. What is this hook’s name?
Leave a Reply
You must be logged in to post a comment.
Last hook before loading the template is template_redirect
You can use it like this:
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: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 😉
You mean a hook when all wordpress function will available but before any output including headers sent?
Well hook your function on
init
. That will call when visiting site. If you want this hook only for admin area then it isadmin_init
.