[wp-hackers] Re: How to redirect to login when filtered posts are
david at coppit.org
Thu Aug 2 00:50:47 GMT 2007
On Thu, 2 Aug 2007, DD32 wrote:
> On Thu, 02 Aug 2007 05:38:16 +1000, David Coppit <david at coppit.org> wrote:
>> 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.
> I'm not sure of the code your using, But what i've done was only register the
> template_redirect hook IF in the filter its realised as needing the hook.
Let me make sure I understand... In my filter callback I call add_action
if I need the redirect. The add_action callback unconditionally calls
auth_redirect. I also need to call remove_action in the action callback,
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