[wp-trac] [WordPress Trac] #38253: Site icon functions using `ms_is_switched()` incorrectly

WordPress Trac noreply at wordpress.org
Thu Oct 13 22:17:05 UTC 2016


#38253: Site icon functions using `ms_is_switched()` incorrectly
--------------------------------------+-------------------------
 Reporter:  jdgrimes                  |       Owner:  jeremyfelt
     Type:  defect (bug)              |      Status:  reviewing
 Priority:  normal                    |   Milestone:  4.7
Component:  Networks and Sites        |     Version:  4.3
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  multisite
--------------------------------------+-------------------------

Comment (by jeremyfelt):

 Replying to [comment:3 flixos90]:
 > I made one additional change: In the initial clause of each function I
 also check whether `$blog_id` is not empty as otherwise we don't need to
 call `switch_to_blog()` at all. While the process is not expensive in that
 case, I think not calling the function makes sense in this case.

 I like this change. Calling `switch_to_blog( 0 );` doesn't seem like
 something we should be in the habit of doing. :)

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


More information about the wp-trac mailing list