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

DD32 wordpress at dd32.id.au
Thu Aug 2 00:16:54 GMT 2007


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.

For what i was doing:
In the Query vars filter,
Check for a query item of ABC,
If exists, then setup a few options, and then register the template  
redirect hook with add_action

once more i'm unsure of your exact code, but is it possible to call  
auth_redirect in the initial filter rather than later in the hook?

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the wp-hackers mailing list