A good hook to check authorization and redirect?

It seems strange to put a redirect in a template page, because so much of the page has already been built by the time you reach a custom page template.

I'm wondering what is a good action hook to use where I can test whether the user's logged in, and whether they're on a particular page/category/etc and wp_redirect them if necessary?

Topic wp-redirect privileges actions redirect hooks Wordpress

Category Web


I'm guessing the built-in template_redirect action is the best for this... :D

http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.