Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created May 17, 2012 16:33
Show Gist options
  • Save zanematthew/2720021 to your computer and use it in GitHub Desktop.
Save zanematthew/2720021 to your computer and use it in GitHub Desktop.
Hook into template redirect before it can redirect
<?php
add_action('template_redirect', function() {
$tmp = explode( '/', $_SERVER['REQUEST_URI'] );
$my_slug = 'feeds';
if ( isset( $tmp ) && $tmp[1] == $my_slug ) {
load_template( '/path/to/my/template/' );
// or do what ever you want
exit();
}
}, 6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment