WordPress.org

Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #37958, comment 2


Ignore:
Timestamp:
09/06/2016 06:15:07 PM (3 years ago)
Author:
johnjamesjacoby
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37958, comment 2

    v1 v2  
    1 Neat idea. And IIRC, this is actually how `switch_to_blog()` originally worked in the early days, around WordPress 2.5. The adverse effect for the rest of core was noticed in places where switching happened on actions & filters, where it wouldn't/couldn't properly clean up after itself, leaving the environment in an unpredictable state.
     1Neat idea. And IIRC, this is actually how `switch_to_blog()` originally worked in the early days, around WordPress 2.5. The adverse effect for the rest of core was noticed in places where switching happened on actions & filters, where it wouldn't/couldn't properly clean up after itself, leaving the environment in an unpredictable state, so the bulkier more-thorough implementation won out.
    22
    33I've always felt this type of approach is most useful when you already know ahead of time an array of site ID's you want to quickly switch between. If we can count on that always being true, maybe the way to implement this is actually on-top of the existing API with a `$quick` parameter, and a `stash_current_blog()` helper that gets called before the loop happens.