wpseek.com
WordPress开发者和主题制作者的搜索引擎
template_redirect › WordPress动作钩子
Since1.5.0
已弃用n/a
› do_action( 'template_redirect' )
| 定义在: |
|
| 文档: |
Fires before determining which template to load.
This action hook executes just before WordPress determines which template page to load. It is a good hook to use if you need to do a redirect with full knowledge of the content that has been queried. Note: Loading a different template is not a good use of this hook. If you include another template and then use `exit()` or `die()`, no subsequent `template_redirect` hooks will be run, which could break the site’s functionality. Instead, use the {@see 'template_include'} filter hook to return the path to the new template you want to use. This will allow an alternative template to be used without interfering with the WordPress loading process.Related Functions: get_template_directory, wp_validate_redirect, auth_redirect, wp_safe_redirect, wp_redirect, get_template_directory_uri
Related Hooks: template_directory, template_directory_uri, auth_redirect, wp_redirect, logout_redirect