[wp-trac] [WordPress Trac] #37948: Use `WP_Site` class globally

WordPress Trac noreply at wordpress.org
Fri Sep 16 18:16:58 UTC 2016


#37948: Use `WP_Site` class globally
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Networks and Sites                   |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch needs-unit-tests 2nd-      |  Resolution:
  opinion                                        |     Focuses:  multisite
-------------------------------------------------+-------------------------

Comment (by flixos90):

 Replying to [comment:4 jeremyfelt]:
 > Can you highlight some others beyond `get_blogs_of_user()`? I can
 somewhat see some of the benefits there, but can also see reasons/ways
 around them (I think). I didn't look too closely elsewhere, but it would
 be helpful to have other examples for context.

 Hmm, indeed I couldn't find anything else except `get_blogs_of_user()`, so
 from that point of view it might indeed be a little "too much" to load the
 class globally only for that one function. Let's say we don't make this
 class globally available, how would you continue with #37061? Return a
 different object type on non-multisite like the latest patch does? Or do
 you have another idea? :)

 > In general - I'm wary of pushing for `WP_Site` to exist outside of
 multisite in the near future due to its close relationship with the
 `wp_blogs` table as well as a handful of its properties that only
 multisite understands. Of course, it's always possible that this changes
 in the future. :)

 I think it would be logical to provide the `WP_Site` class to non-
 multisite setups because these actually are a site. While the class is
 usually filled with data from the `wp_blogs` table, it's not restricted to
 that in its current state, and many parameters can easily be filled with
 similar data from a non-multisite setup (as we do in
 `get_blogs_of_user()`, and maybe we could even fill the `public` property
 according to the "Discourage search engines..." setting). But I also see
 your concern as it might become easier to introduce bugs if it's loaded
 everywhere.

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


More information about the wp-trac mailing list