Make WordPress Core

Ticket #43306: 43306.patch

File 43306.patch, 680 bytes (added by aubreypwd, 6 years ago)

This seems to work on either sub-dir or sub-domain setups with get_sites().

  • wp-includes/ms-blogs.php

    diff --git wp-includes/ms-blogs.php wp-includes/ms-blogs.php
    index 34d6c28c76..b18ef17e69 100644
    function get_id_from_blogname( $slug ) { 
    8787        $current_network = get_network();
    8888        $slug            = trim( $slug, '/' );
    8989
    90         $domain = $current_network->domain;
    91         $path   = $current_network->path . $slug . '/';
     90        if ( is_subdomain_install() ) {
     91                $domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain );
     92                $path   = $current_network->path;
     93        } else {
     94                $domain = $current_network->domain;
     95                $path   = $current_network->path . $slug . '/';
     96        }
    9297
    9398        $site_ids = get_sites(
    9499                array(