[wp-trac] [WordPress Trac] #34450: get_id_from_blogname returns false if the main domain starts with www.

WordPress Trac noreply at wordpress.org
Mon Oct 26 09:20:55 UTC 2015


#34450: get_id_from_blogname returns false if the main domain starts with www.
--------------------------------+-----------------------------
 Reporter:  igmoweb             |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.3.1
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 I have a local Multisite installation with the following domain:

 www.wordpress.dev

 I create a new site called: demo1.wordpress.dev, which is fine and works
 as expected (the www. is trimmed as expected too).

 When I try the following code:

 {{{ $result = get_id_from_blogname( 'demo1' ); }}}

 $result is false and not the Blog ID.

 I think that the issue is located inside the get_id_from_blogname
 function:

 {{{ $domain = $slug . '.' . $current_site->domain; }}}
 should be
 {{{ $domain = $slug . '.' . preg_replace( '|^www\.|', '',
 $current_site->domain ); }}}

 But I'm not sure if this could affect other areas.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34450>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list