[wp-trac] [WordPress Trac] #40180: Introduce `get_site_by()` function for multisite

WordPress Trac noreply at wordpress.org
Sat Aug 12 17:03:25 UTC 2017


#40180: Introduce `get_site_by()` function for multisite
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  flixos90
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.9
Component:  Networks and Sites                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback has-unit-     |     Focuses:  multisite
  tests ms-roadmap                               |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 [attachment:40180.3.diff] implements a more straightforward version of
 `get_site_by()`, where it only accepts a single parameter (as mentioned in
 https://core.trac.wordpress.org/ticket/40180#comment:18). With this kind
 of functionality, it actually works similar like `get_term_by()`, thus the
 name now makes sense.

 The idea is that the new `url` field is a combination of domain and path
 and thus covers that use-case in a simple way. Unit tests for the function
 are included.

 I like this approach far better, and it clears up the naming issues we
 discussed on Tuesday. Furthermore `get_site_by( 'url', 'mysite.com/foo/'
 )` is simpler than `get_site_by( array( 'domain' => 'mysite.com', 'path'
 => '/foo/' ) )`.

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


More information about the wp-trac mailing list