From 8f1f88a82a2b592f41e781a7a5147f776f4cd598 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 10 Sep 2012 19:37:08 +0000 Subject: [PATCH] Don't use set_url_scheme() in wp_guess_url(). wp_guess_url() is used during install before set_url_scheme() is loaded. Props SergeyBiryukov. fixes #20759 git-svn-id: http://core.svn.wordpress.org/trunk@21797 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 91314b5aab..b051467a02 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2981,10 +2981,12 @@ function force_ssl_admin( $force = null ) { * @return string */ function wp_guess_url() { - if ( defined('WP_SITEURL') && '' != WP_SITEURL ) + if ( defined('WP_SITEURL') && '' != WP_SITEURL ) { $url = WP_SITEURL; - else - $url = set_url_scheme( preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) ); + } else { + $schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet + $url = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); + } return rtrim($url, '/'); }