The redirect loop is caused by the COOKIE_DOMAIN define affecting both your main and subdomains. When set, it forces both sites to share the same domain for cookies, creating a conflict. Instead of a static define, use a dynamic filter to set the cookie domain conditionally.
Add this to your wp-config.php:
define(‘COOKIE_DOMAIN’, false);
Then add this to a site-specific plugin or your theme’s functions.php:
add_action(‘init’, ‘my_cookie_domain_fix’);
function my_cookie_domain_fix() {
if ( is_admin() && !is_main_site() ) {
define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’] );
}
}
This ensures the COOKIE_DOMAIN is only set for subsite admins, preventing the main site, conflict.