If, for example I want to do a wp_is_mobile check…
I have tried template_redirect and then I tried init and then I tried after_setup_theme .
But with all of these I am getting a “too many redirects” error.
What would be the best hook for this?
Thanks
Edit: Technically template_redirect just didn’t work (a different redirect rule took precedence).
I dont’ think this problem depends on a hook type itself. Just tested wp_is_mobile() on ‘init’ and ‘template_redirect’ in an empty plugin, works properly in both cases.
“Too many redirects” is a very general error. It’s often related to a server configuration: SSL, .httacces, HTTPS, permlinks, taxonomies rewrite mods etc. So it my look like the hook breaks the code even when it just works like a trigger that executes some buggy functionality.