[wp-hackers] Throw 404 error via plugin

Ryan Bilesky rbilesky at gmail.com
Wed Jan 12 03:01:13 UTC 2011

So I am working on a plugin where I want to selectivly throw a 404 error.

I try header() and this sets the http header to show a not found error, but
I get the browsers default 404 error page.

I try including the 404.php template file but while it looks like a 404
error to the user, the http header status shows 200 ok.

I try using both methods together again no luck,.  I want the http status
code to show 404 AND to use the 404.php template to show the user.  How does
the core do this?

More information about the wp-hackers mailing list