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.


Top ↑

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.


Top ↑

Source

File: wp-includes/template-loader.php

View on Trac


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.