[wp-trac] [WordPress Trac] #21077: Add support for custom ports in multisite site addresses

WordPress Trac noreply at wordpress.org
Sat May 4 22:57:52 UTC 2024


#21077: Add support for custom ports in multisite site addresses
--------------------------------------+--------------------------
 Reporter:  djzone                    |       Owner:  johnbillion
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  6.6
Component:  Bootstrap/Load            |     Version:  3.4
 Severity:  normal                    |  Resolution:
 Keywords:  early add-to-field-guide  |     Focuses:  multisite
--------------------------------------+--------------------------

Comment (by spacedmonkey):

 Here is quick fix.

 {{{#!php
         private function _set_cookie_domain() {
                 if ( ! empty( $this->cookie_domain ) ) {
                         return;
                 }

                 $this->cookie_domain = parse_url( $this->domain,
 PHP_URL_HOST );
                 if ( str_starts_with( $this->cookie_domain, 'www.' ) ) {
                         $this->cookie_domain = substr(
 $this->cookie_domain, 4 );
                 }
         }

 }}}

 In the WP_Network class, when setting cookie domain, use `parse_url` to
 get the domain and strip the port number.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/21077#comment:55>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list