On this page
apply_filters( "{$type}_template", string $template, string $type, string[] $templates )
Filters the path of the queried template by type.
Description
The dynamic portion of the hook name, $type, refers to the filename — minus the file extension and any non-alphanumeric characters delimiting words — of the file to load.
This hook also applies to various types of files loaded as part of the Template Hierarchy.
Possible hook names include:
404_templatearchive_templateattachment_templateauthor_templatecategory_templatedate_templateembed_templatefrontpage_templatehome_templateindex_templatepage_templatepaged_templateprivacypolicy_templatesearch_templatesingle_templatesingular_templatetag_templatetaxonomy_template
Parameters
$templatestring-
Path to the template. See locate_template() .
More Arguments from locate_template( ... $args )
Additional arguments passed to the template.
$typestring-
Sanitized filename without extension.
$templatesstring[]-
A list of template candidates, in descending order of priority.
More Information
If you need more granular control over the template selection and loading system of WordPress, consider using template_include instead.
Source
File: wp-includes/template.php. View all references
return apply_filters( "{$type}_template", $template, $type, $templates );
Related
Used By
| Used By | Description |
|---|---|
| get_query_template() wp-includes/template.php | Retrieves path to a template. |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/type_template