Make WordPress Core

Ticket #9873: 9873.patch

File 9873.patch, 754 bytes (added by johnpbloch, 11 years ago)

Explicit COOKIE_DOMAIN for www inconsistency

  • wp-includes/default-constants.php

     
    226226        /**
    227227         * @since 2.0.0
    228228         */
    229         if ( !defined('COOKIE_DOMAIN') )
    230                 define('COOKIE_DOMAIN', false);
     229        if ( ! defined( 'COOKIE_DOMAIN' ) ) {
     230                $cookie_domain = false;
     231                $home_host = parse_url( home_url(), PHP_URL_HOST );
     232                $site_host = parse_url( site_url(), PHP_URL_HOST );
     233                if ( $home_host !== $site_host && str_replace( 'www.', '', $home_host ) === str_replace( 'www.', '', $site_host ) )
     234                        $cookie_domain = str_replace( 'www.', '', $site_host );
     235                define( 'COOKIE_DOMAIN', $cookie_domain );
     236        }
    231237}
    232238
    233239/**