/wp-admin/ Redirection Loop Fix

06/08/2025
wp-admin Redirect Loop

When you try to access the /wp-admin/ page and encounter a redirection loop, you can fix it with the code below. Add the code to your functions.php file.

/* SSL Settings */
define('FORCE_SSL_ADMIN', true);

/* Turn HTTPS 'on' if HTTP_X_FORWARDED_PROTO matches 'https' */
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
    $_SERVER['HTTPS'] = 'on';
}

Source:

https://stackoverflow.com/questions/54200976/wp-admin-redirect-loop