Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #36737, comment 2


Ignore:
Timestamp:
02/10/2017 01:15:21 AM (10 years ago)
Author:
SergeyBiryukov

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36737, comment 2

    v1 v2  
    1313define('WP_HOME',  "http://{$_SERVER['HTTP_HOST']}");
    1414define('WP_SITEURL', "http://{$_SERVER['HTTP_HOST']}");
     15
     16ob_start( 'ob_replace_home_url' );
     17function ob_replace_home_url( $content ) {
     18        $home_urls = array(
     19                'http://subdomain1.site.com',
     20                'http://subdomain2.site.com',
     21                'http://www.site.com',
     22        );
     23
     24        $content = str_replace( $home_urls, WP_HOME, $content );
     25
     26        return $content;
     27}
    1528}}}
     29
     30Most of the time, just `WP_HOME` and `WP_SITEURL` would be enough to run the same install from multiple domains. The output buffering here just makes sure that URLs in content (images, etc.) always have the currently requested domain.