WordPress action hook · part of WordPress core
template_redirect
A WordPress core action that 19 plugins also fire themselves, running on 1.1M+ sites between them.
How to use template_redirect
It's an action: your callback runs at that point. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'template_redirect', function() {
// Your code runs here.
}, 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 →
19 plugins that fire template_redirect
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
do_action( 'template_redirect' )classes/wp-security-process-renamed-login-page.php:272 -
Product Filter for WooCommerce by WBW50,000+ installs
do_action( 'template_redirect' )modules/woofilters/class-woobewoo-pf-woofilters-controller.php:666 -
Visual Composer Website Builder30,000+ installs
do_action( 'template_redirect' )visualcomposer/Modules/Elements/AjaxShortcode/Controller.php:118 -
MasterStudy LMS WordPress Plugin10,000+ installs
do_action( 'template_redirect' )_core/stm-lms-templates/course-player.php:299 -
Groovy Menu Plugin (Free)4,000+ installs
do_action( 'template_redirect' )includes/modules/virtualpages/inc/VirtualPagesTemplateLoader.php:20 -
Listdom: AI-powered Business Directory with Classifieds Ads Listings1,000+ installs
do_action( 'template_redirect' )app/includes/hooks.php:161 -
Login Armor600+ installs
do_action( 'template_redirect' )includes/class-hide-login.php:1857 -
Read More Login200+ installs
do_action( 'template_redirect' )controllers/ReadMoreLoginController.php:580 -
Give as you Live100+ installs
do_action( 'template_redirect' )admin/buttons_delete.php:34 -
Appful40+ installs
do_action( 'template_redirect' )includes/wp/WPPageManager.php:78 -
Hiperlink Security30+ installs
do_action( 'template_redirect' )modules/login-url/includes/answer.php:122 -
Marcelo Site Connector20+ installs
do_action( 'template_redirect' )marcelo-site-connector.php:10283 -
AQT alloq TempoFewer than 10 installs
do_action( 'template_redirect' )src/Modules/Login.php:365 -
DolphyFewer than 10 installs
do_action( 'template_redirect' )classes/Template/Loader.php:13 -
Customer Service to Content Marketing Converter by ProduckFewer than 10 installs
do_action( 'template_redirect' )vpage/templateloader.php:27 -
GdprAccept LiteFewer than 10 installs
do_action( 'template_redirect' )inc/Api/VirtualPages/TemplateLoader.php:15 -
WPDevHub Troubleshooting GuidesFewer than 10 installs
do_action( 'template_redirect' )classes/vp/class.DSCF_DTG_VirtualPages_TemplateLoader.php:21 -
WPDevHub Link ManagerFewer than 10 installs
do_action( 'template_redirect' )classes/vp/class.DSCF_DLM_VirtualPages_TemplateLoader.php:21 -
Fuzzy FilterFewer than 10 installs
do_action( 'template_redirect' )modules/filters/class-view.php:876
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.