WordPress hook directory
template_redirect
Description
Runs before the determination of the template file to be used to display the requested page, so that a plugin can override the template file choice. Example (pedagogical, not useful): Redirect all requests to the all.php template file in the current themes' directory.
This description was scraped automatically from the WordPress filter reference
or action reference
. If it looks like this is the wrong description, please tell me so I can fix my code.
WordPress version history for template_redirect
This database has information for all major versions from WP 1.2.1 through 2.6. (Note that some intermediate versions are not indexed, particularly 2.0.1 through 2.0.10.) If 2.6 does not show up below, then this hook is deprecated.
| Version | File | Type | |
|---|---|---|---|
| 1.5 | wp-blog-header.php | View hook in source | action |
| 1.5.1 | wp-blog-header.php | View hook in source | action |
| 1.5.2 | wp-blog-header.php | View hook in source | action |
| 2.0 | wp-includes/template-loader.php | View hook in source | action |
| 2.0.11 | wp-includes/template-loader.php | View hook in source | action |
| 2.1 | wp-includes/template-loader.php | View hook in source | action |
| 2.1.3 | wp-includes/template-loader.php | View hook in source | action |
| 2.2 | wp-includes/template-loader.php | View hook in source | action |
| 2.2.1 | wp-includes/template-loader.php | View hook in source | action |
| 2.2.2 | wp-includes/template-loader.php | View hook in source | action |
| 2.2.3 | wp-includes/template-loader.php | View hook in source | action |
| 2.3 | wp-includes/template-loader.php | View hook in source | action |
| 2.3.1 | wp-includes/template-loader.php | View hook in source | action |
| 2.3.2 | wp-includes/template-loader.php | View hook in source | action |
| 2.3.3 | wp-includes/template-loader.php | View hook in source | action |
| 2.5 | wp-includes/template-loader.php | View hook in source | action |
| 2.6 | wp-includes/template-loader.php | View hook in source | action |
Related Hooks
We find related hooks using word stems. template_redirect has 2 significant word stem(s): template, redirect. Note that some of the hooks below may not appear in all versions of WP.