template_include WordPress Filter Hook
The template_include hook is one of the most important hooks in WordPress. It is used to tell WordPress what template to use to display the content for a specific page. This hook is used by themes and plugins to override the default template. The template_include hook is used by WordPress to determine which template should be used to display the content for a specific page. This hook is used by themes and plugins to override the default template. By default, WordPress will use the template specified in the theme's header.php file. However, if a plugin or theme uses the template_include hook, WordPress will use the template specified by the hook instead. The template_include hook is a powerful tool that can be used to customize the way WordPress displays content. It is important to be familiar with this hook in order to be able to create custom templates.
apply_filters( 'template_include', string $template ) #
Filters the path of the current template before including it.
Parameters
- $template
(string)The path of the template to include.
More Information
This filter hook is executed immediately before WordPress includes the predetermined template file. This can be used to override WordPress’s default template behavior.
Source
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |