[wp-hackers] Throw 404 error via plugin

Ryan Bilesky rbilesky at gmail.com
Thu Jan 13 17:51:47 UTC 2011


Ok I spoke too soon, this still is not working.

What I might do is this, create a file call it say 404error.php and it would
look like this

<?php

include ('./wp_load.php');
include (TEMPLATEPATH . '/404.php');

?>

Then set my .htaccess to use this 404error.php as my 404 error document then
just send the 404 header in my plugin via header();

Not the simplest option but that should work if nobody has any other ideas.

On Thu, Jan 13, 2011 at 9:03 AM, Ryan Bilesky <rbilesky at gmail.com> wrote:

> Where would I redirect them?
>
> I'll try the pre_get_posts hook given the explination I think that should
> workl. Thanks all for your help.
>
> On Jan 13, 2011 2:08 AM, "24/7" <24-7 at gmx.net> wrote:
> > Don't know if this is true, but here goes my theory: Ryan tries to
> > bring someone to a 404 page when some condition is not met. So why not
> > if { bla() } else { wp_redirect('wherever', 404) } ?
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list