[wp-hackers] Re: How to redirect to login when filtered posts are empty?

David Coppit david at coppit.org
Wed Aug 1 19:38:16 GMT 2007


On Tue, 31 Jul 2007, David Coppit wrote:

> My question is this: Is there some way to get WP to redirect to the login
> screen in this case instead of showing a 404 message?

Here's a workable solution:
   - In my filter, set a global if the page should be hidden
   - Use add_action to hook template_redirect
   - In my hook, check to see if the global is set and call auth_redirect()
     if it is.

I wish there was a better way than setting a global, but I don't see it.

David

_____________________________________________________________________
David Coppit                           david at coppit.org
The College of William and Mary        http://coppit.org/

"When the president does it that means that it is not illegal."
- Richard Nixon on domestic surveillance, 5/19/1977
"Do I have the legal authority to do this? And the answer is, absolutely."
- George W. Bush on domestic surveillance, 12/19/2005


More information about the wp-hackers mailing list