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
File: wp-includes/template-loader.php
.
View all references
$template = apply_filters( 'template_include', $template );
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
This example includes a new template on a page called ‘portfolio’ if the new template file was found.
Top ↑
Feedback
It is advisable to use a different variable for the new template, check if the file for the new template exists, and if not, use the original value. — By crstauf —