Redirecting logged in users to custom URL
You wouldn’t replace the $pagenow, but would check it’s value: ‘wp-login.php’ === $pagenow. I recommend using one of the $_SERVER values, or WordPress helper functions (ex: is_page(), is_login()) on the template_redirect action hook. add_action( ‘template_redirect’, static function () { if ( ! is_user_logged_in() ) { return; } if ( ! is_login() ) { return; } … Read more