From 4c76d9d4f38074d37a0adcb53227135fdfaa2de6 Mon Sep 17 00:00:00 2001 From: Giuseppe Mazzapica Date: Thu, 25 Nov 2021 17:42:37 +0100 Subject: [PATCH] Take into account SERVER_PORT when calculating WP_HOME See #101, #102 --- templates/wp-config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/wp-config.php b/templates/wp-config.php index a8dc11f..6937544 100644 --- a/templates/wp-config.php +++ b/templates/wp-config.php @@ -215,6 +215,8 @@ if (!defined('WP_HOME')) { $home = filter_var($_SERVER['HTTPS'] ?? '', FILTER_VALIDATE_BOOLEAN) ? 'https://' : 'http://'; $home .= $_SERVER['SERVER_NAME'] ?? 'localhost'; + $port = $_SERVER['SERVER_PORT'] ?? ''; + (is_numeric($port) && (int)$port > 0) and $home .= sprintf(':%d', $port); define('WP_HOME', $home); unset($home); }