WordPress.org

Make WordPress Core

Ticket #20759: 20759.2.diff

File 20759.2.diff, 806 bytes (added by SergeyBiryukov, 6 years ago)
  • wp-includes/functions.php

     
    29812981 * @return string
    29822982 */
    29832983function wp_guess_url() {
    2984         if ( defined('WP_SITEURL') && '' != WP_SITEURL )
     2984        if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
    29852985                $url = WP_SITEURL;
    2986         else
    2987                 $url = set_url_scheme( preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
     2986        } else {
     2987                $schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
     2988                $url = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
     2989        }
    29882990
    29892991        return rtrim($url, '/');
    29902992}