Earliest WP Hook to Safely and Reliably Redirect

registered_taxonomy is not available to normal plugins, only to must-use plugins. The first hook available to normal plugins is plugins_loaded. Although, the current user isn’t set at this point, so there’s no reason to hook this early.

set_current_user fires on every page – even if not logged in – immediately after the current user is set. See here. The function that calls the hook is “pluggable” though, so if a plugin does decide to override that function, it’s possible that it won’t fire that hook. That seems unlikely to me, so I do use this hook to use user data.

There are a couple other hooks fired besides set_current_userunload_textdomain, load_textdomain, and after_setup_theme – that fire on every page. I suppose you could use those if you really wanted to.

If it were me, I’d use set_current_user. If you want to be extra careful, use init. init is early enough that you can still safely redirect.

As an aside, I’d recommend using the Query Monitor plugin. I’ve found it indispensable for WordPress development.

error code: 523