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

WordPress Trac noreply at wordpress.org
Fri Mar 17 10:54:33 UTC 2017


#40180: Introduce `get_site_by()` function for multisite
--------------------------------+-------------------------
 Reporter:  flixos90            |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  4.8
Component:  Networks and Sites  |    Version:
 Severity:  normal              |   Keywords:  2nd-opinion
  Focuses:  multisite           |
--------------------------------+-------------------------
 As @stephdau mentioned on #40064, the new `get_site()` function from 4.6
 is not a direct replacement for `get_blog_details()` which we are planning
 to deprecate.

 Therefore I think it makes sense to introduce a function `get_site_by()`
 that is basically a wrapper for a `WP_Site_Query` (with `LIMIT 1`), and
 then runs `array_shift()` to only return the first result. This function
 would then become the direct replacement that people who previously relied
 on `get_blog_details()` with something other than an ID could use.

 Parameter-wise, we should probably adjust it a little bit to match things
 like `get_term_by()`, which also makes the way that function works more
 explicit.

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


More information about the wp-trac mailing list