template_redirect
Action HookDescription
Fires before determining which template to load.Hook Information
File Location |
wp-includes/template-loader.php
View on GitHub
|
Hook Type | Action |
Line Number | 13 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into template_redirect
add_action('template_redirect', 'my_custom_function');
function my_custom_function() {
// Your custom code here
}
Source Code Context
wp-includes/template-loader.php:13
- How this hook is used in WordPress core
<?php
8 /**
9 * Fires before determining which template to load.
10 *
11 * @since 1.5.0
12 */
13 do_action( 'template_redirect' );
14 }
15
16 /**
17 * Filters whether to allow 'HEAD' requests to generate content.
18 *
PHP Documentation
<?php
/**
* Fires before determining which template to load.
*
* @since 1.5.0
*/
Quick Info
- Hook Type: Action
- Parameters: 0
- File: wp-includes/template-loader.php
Related Hooks
Related hooks will be displayed here in future updates.