Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: template_redirect

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
14       *
15       * Note: Loading a different template is not a good use of this hook. If you include another template
16       * and then use `exit()` or `die()`, no subsequent `template_redirect` hooks will be run, which could
17       * break the site’s functionality. Instead, use the {@see 'template_include'} filter hook to return
18       * the path to the new template you want to use. This will allow an alternative template to be used
19       * without interfering with the WordPress loading process.
20       *
21       * @since 1.5.0
22       */
23      do_action( 'template_redirect' );
24 }
25
26 /**
27  * Filters whether to allow 'HEAD' requests to generate content.
28  *
29  * Provides a significant performance bump by exiting before the page
30  * content loads for 'HEAD' requests. See #14348.
31  *
32  * @since 3.5.0