Best hook to check system requirements

Continuing the discussion from A hook that fires before wp_head() on the front end?:

Related question…

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 :sunflower:

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.


I changed it back to template_redirect , but lowered the priority on the action and that worked.

Thank you.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.