使用以下代码在WP中设置WP\\U HOME和WP\\U SITEURL是否有任何缺点。单站点安装和多站点安装的配置:
/**
* Site Host URLs
*/
$hostname = $_SERVER[\'HTTP_HOST\'];
if(isset($_SERVER[\'HTTP_X_FORWARDED_HOST\']) && !empty($_SERVER[\'HTTP_X_FORWARDED_HOST\'])) {
$hostname = $_SERVER[\'HTTP_X_FORWARDED_HOST\'];
}
$protocol = isset($_SERVER[\'HTTPS\'])
&& ($_SERVER[\'HTTPS\'] == \'on\'
|| $_SERVER[\'HTTPS\'] == 1)
|| isset($_SERVER[\'HTTP_X_FORWARDED_PROTO\'])
&& $_SERVER[\'HTTP_X_FORWARDED_PROTO\'] == \'https\'
? \'https://\'
: \'http://\';
$siteUrl = $protocol . rtrim($hostname, \'/\');
define(\'WP_HOME\', $siteUrl);
define(\'WP_SITEURL\', $siteUrl);
我知道我没有什么悬赏的名声,但你的回答会得到我百分之百的赞赏。