WordPress filter hook · part of WordPress core
template_include
A WordPress core filter that 30 plugins also fire themselves, running on 1.7M+ sites between them.
“This filter is documented in wp-includes/template-loader.php”
How to use template_include
It's a filter: your callback receives the value, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'template_include', function( $template ) {
// Change $template here.
return $template;
}, 10, 1 );Argument names come from All-In-One Security (AIOS)'s source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
30 plugins that fire template_include
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
All-In-One Security (AIOS)1+ million installs
apply_filters( 'template_include', $template )classes/wp-security-process-renamed-login-page.php:277 -
SiteGuard WP Plugin600,000+ installs
apply_filters( 'template_include', $template )classes/siteguard-rename-login.php:680 -
Visual Composer Website Builder30,000+ installs
apply_filters( 'template_include', $template )visualcomposer/Modules/FrontView/MaintenanceModeController.php:101 -
FeedWordPress8,000+ installs
apply_filters( 'template_include', $template )feedwordpress.php:1478 -
Ultimate 410 Gone Status Code6,000+ installs
apply_filters( 'template_include', $template )src/Plugin.php:40 -
WP Fusion Lite4,000+ installs
apply_filters( 'template_include', $template )includes/class-access-control.php:634 -
Groovy Menu Plugin (Free)4,000+ installs
apply_filters( 'template_include', apply_filters( 'virtual_page_template', $template ) )includes/modules/virtualpages/inc/VirtualPagesTemplateLoader.php:22 -
Login Armor600+ installs
apply_filters( 'template_include', $template )includes/class-hide-login.php:1863 -
Diamond Sierra Site Defense100+ installs
apply_filters( 'template_include', get_404_template() )includes/class-dssd-login-url.php:264 -
Show Template60+ installs
apply_filters( 'template_include', $this->template )show-template.php:44 -
Mask My Admin50+ installs
apply_filters( 'template_include', $template )includes/class-url-masking.php:296 -
Hiperlink Security30+ installs
apply_filters( 'template_include', $template )modules/login-url/includes/answer.php:128 -
Post Forking20+ installs
apply_filters( 'template_include', $template )includes/preview.php:66 -
Marcelo Site Connector20+ installs
apply_filters( 'template_include', $template )marcelo-site-connector.php:10317 -
Add Page From Template10+ installs
apply_filters( 'template_include', $templatePath )includes/class-loader.php:202 -
Post-Specific Widgets10+ installs
apply_filters( 'template_include', $template )post-specific-widgets-functions.php:47 -
Protect Pages & Posts10+ installs
apply_filters( 'template_include', $template )includes/post-page-loader.php:98 -
Forensix Digital10+ installs
apply_filters( 'template_include', $template )src/Apps/Maintenance/MaintenanceApp.php:399 -
StaticPush by Quintaphon10+ installs
apply_filters( 'template_include', $template )includes/class-cfsp-feeds.php:60 -
Taxonomy Templates10+ installs
apply_filters( 'template_include', $template )taxonomy-templates.php:38 -
AQT alloq TempoFewer than 10 installs
apply_filters( 'template_include', '' !== $template ? $template : get_index_template() )src/Modules/Login.php:370 -
SmartCloud Agent ComposerFewer than 10 installs
apply_filters( 'template_include', $resolved )src/Execution/Rendered_Preview_Service.php:316 -
Neksio Login & File SecurityFewer than 10 installs
apply_filters( 'template_include', $template )includes/class-login-url-rewriter.php:321 -
PathGuard RedirectsFewer than 10 installs
apply_filters( 'template_include', $template )includes/URLB_Blocker.php:188 -
DolphyFewer than 10 installs
apply_filters( 'template_include', apply_filters('virtual_page_template', $template) )classes/Template/Loader.php:16 -
WPS Protect: Login URL & Security HeadersFewer than 10 installs
apply_filters( 'template_include', $template )src/Login/Gate.php:407 -
GdprAccept LiteFewer than 10 installs
apply_filters( 'template_include', apply_filters( 'virtual_page_template', $template ) )inc/Api/VirtualPages/TemplateLoader.php:17 -
WPDevHub Troubleshooting GuidesFewer than 10 installs
apply_filters( 'template_include', apply_filters( 'virtual_page_template', $template ) )classes/vp/class.DSCF_DTG_VirtualPages_TemplateLoader.php:53 -
WPDevHub Link ManagerFewer than 10 installs
apply_filters( 'template_include', apply_filters( 'virtual_page_template', $template ) )classes/vp/class.DSCF_DLM_VirtualPages_TemplateLoader.php:53 -
oOMF! AccessFewer than 10 installs
apply_filters( 'template_include', $template )includes/Frontend/class-hideadmin.php:582
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.