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

WordPress Trac noreply at wordpress.org
Thu Mar 23 17:22:44 UTC 2017


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

 * keywords:  2nd-opinion => has-patch dev-feedback has-unit-tests


Comment:

 [attachment:40180.diff] is a possible implementation for `get_site_by()`,
 including unit tests. It accepts either a `$field` and its `$value` as
 parameters or a single array of fields and their values.

 I decided to not make the function a one-to-one replacement for
 `get_blog_details()` as we're probably not going to deprecate that
 function. However, `get_site_by()` supports everything that
 `get_blog_details()` needs and does that in a much more efficient way, so
 I suggest we should use the new `get_site_by()` in `get_blog_details()` -
 all the latter needs to do then is tweak how the parameters are passed to
 it and modify the return value appropriately.

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


More information about the wp-trac mailing list