Redirect logged in users if they are on a specific page
One problem is that you’re hooking in too early. Reference the Hooks API Action Reference. Template conditionals such as is_page() are only available after the query has been set up and parsed. The earliest action that you can usually safely rely on query conditionals is pre_get_posts. You’re hooking into init, which fires much earlier: muplugins_loaded … Read more