Make WordPress Core


Ignore:
Timestamp:
10/07/2015 09:45:17 PM (9 years ago)
Author:
johnbillion
Message:

Correctly set the scheme of the home and siteurl options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.

Fixes #33620
Props tryon, johnbillion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r34912 r34916  
    13181318 */
    13191319function install_blog( $blog_id, $blog_title = '' ) {
    1320     global $wpdb, $wp_roles;
     1320    global $wpdb, $wp_roles, $current_site;
    13211321
    13221322    // Cast for security
     
    13401340    $wp_roles = new WP_Roles();
    13411341
    1342     $url = untrailingslashit( $url );
    1343 
    1344     update_option( 'siteurl', $url );
    1345     update_option( 'home', $url );
     1342    $siteurl = $home = untrailingslashit( $url );
     1343
     1344    if ( ! is_subdomain_install() ) {
     1345
     1346        if ( 'https' === parse_url( get_network_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
     1347            $siteurl = set_url_scheme( $siteurl, 'https' );
     1348        }
     1349        if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) {
     1350            $home = set_url_scheme( $home, 'https' );
     1351        }
     1352
     1353    }
     1354
     1355    update_option( 'siteurl', $siteurl );
     1356    update_option( 'home', $home );
    13461357
    13471358    if ( get_site_option( 'ms_files_rewriting' ) )
Note: See TracChangeset for help on using the changeset viewer.