[wp-trac] [WordPress Trac] #37413: Use `get_site()` instead of global `$current_blog`

WordPress Trac noreply at wordpress.org
Mon Aug 29 15:38:53 UTC 2016


#37413: Use `get_site()` instead of global `$current_blog`
--------------------------------+------------------------
 Reporter:  flixos90            |       Owner:  flixos90
     Type:  enhancement         |      Status:  closed
 Priority:  normal              |   Milestone:
Component:  Networks and Sites  |     Version:  4.6
 Severity:  normal              |  Resolution:  invalid
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+------------------------
Changes (by flixos90):

 * status:  assigned => closed
 * resolution:   => invalid
 * milestone:  4.7 =>


Comment:

 I just searched through the WordPress codebase and actually wasn't able to
 find any occurrence of the `$current_blog` global where the code was not
 part of the global scope anyway. Therefore I would consider this an
 invalid ticket - when I opened it, I assumed there were cases where this
 change was necessary, so it's great that there aren't. :)

 Although I mentioned this in the ticket description, I don't think we
 should (and even can) replace `get_current_blog_id()` occurrences. While
 it would be nice for more usage of current naming conventions in the code,
 `get_current_blog_id()` is easier to use than `get_site()->id` and, more
 importantly, also works outside of Multisite.

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


More information about the wp-trac mailing list