[wp-hackers] Hack to prevent 404s

Brian Layman Brian at TheCodeCave.com
Tue Jun 13 18:59:37 GMT 2006


I didn't think a plug-in was possible since I could not find a nearby hook,
but I just found template_redirect

http://codex.wordpress.org/Plugin_API

template_redirect

No parameter. Executes before the determination of the template file to be
used to display the requested page. Useful for providing additional
templates based on request criteria. Example (pedagogical, not useful):
Redirect all requests to the all.php template file in the current themes'
directory. 

function all_on_one () {
	include(TEMPLATEPATH . '/all.php');
	exit;
}

add_action('template_redirect', 'all_on_one');


With that, as you suggest, I can redirect links in ALL of my old styles to a
301 page.  

Thanks for the push in that direction. 

_______________________________________________
Brian Layman
www.TheCodeCave.com
 


More information about the wp-hackers mailing list