[wp-hackers] Hack to prevent 404s
Brian Layman
Brian at TheCodeCave.com
Tue Jun 13 19:09:38 GMT 2006
BTW, I call Dibs on this plug-in! ;) So no writing it in the next few hours
just because you're in a different time zone and already out of work for the
day. :p
-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Brian Layman
Sent: Tuesday, June 13, 2006 3:00 PM
To: wp-hackers at lists.automattic.com
Subject: RE: [wp-hackers] Hack to prevent 404s
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