Include a file before current template file

template_redirect runs before template_include. You can demonstrate that with this: add_filter( ‘template_include’, ‘var_template_include’, 1000 ); function var_template_include( $t ){ echo __FUNCTION__; } // use template redirect to include file add_action(‘template_redirect’, ‘ra_template_block’); function ra_template_block() { echo __FUNCTION__; } Or you could just look at the source: http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/template-loader.php Since your code exits in template_redirect the global that … Read more