[wp-hackers] Force 404

Dougal Campbell dougal at gunters.org
Tue May 17 16:37:27 UTC 2011


On May 17 2011 12:15 PM, Gavin Pearce wrote:
> status_header('404');
> $wp_query->set_404();
>
> init is too early to call this (obviously), try further down the line.
>

The 'template_redirect' hook is usually the best place for stuff like 
this. You know pretty much everything you need to know in the evironment 
already, but the theme hasn't been hit yet. Perfect time to hijack the 
request and override things.

-- 
Dougal Campbell <dougal at gunters.org>
http://dougal.gunters.org/
http://twitter.com/dougal
http://twitual.com/


More information about the wp-hackers mailing list