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?
Custom hooks are created and called in the same way that Core's hooks are, with add_action() / do_action() and add_filter() / apply_filters(). Since any plugin can create a custom hook, it's important to prefix your hook names to avoid collisions with other plugins.
do_action( 'wp_loaded' ) This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
Action Hooks are a very useful tool in WordPress and they are used to perform functions (actions) in specific places of a theme or plugin. Many themes and plugins, such as Total, use action hooks as an easy way for users to modify the output of the project or to add their own custom code.
WordPress hooks enable us to assign each callback with a priority number (the default if you don't add a priority is 10).
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" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With