template_redirect

template_redirect is one of WordPress' most useful hooks. It is an action fired immediately before loading a template's themes. The posts query has been made, and all of the is_* functions will work. Nothing has been output to the browser, you can you can still use this for a redirect, and use the queried post data to help make your decision. It is also useful for implementing a custom template style.

Context:

File: wp-includes/template-loader.php
if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
	do_action('template_redirect');

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn't return, and shouldn't take any parameters

This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this: add_action('template_redirect', 'your_function');