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

WordPress Trac noreply at wordpress.org
Sat Oct 8 13:33:27 UTC 2016


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

 * keywords:  has-patch needs-unit-tests => has-patch has-unit-tests


Comment:

 [attachment:38253.diff] adds unit tests to ensure the switched state is
 preserved for the three functions.

 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.

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


More information about the wp-trac mailing list