[wp-hackers] Cloning content from Master site into new sites on a WP Network
highfive at jesserfriedman.com
Wed Jul 11 19:39:53 UTC 2012
In this case I would know exactly what site I want to switch to and would
only happen when a new site is added. Seems like it won't cause too much
of a headache in that instance.
On Wed, Jul 11, 2012 at 3:34 PM, Otto <otto at ottodestruct.com> wrote:
> On Wed, Jul 11, 2012 at 2:14 PM, Bill Dennen <dennen at gmail.com> wrote:
> > One thing that has puzzled me is the notion that switch_to_blog
> > shouldn't be used too often. How often is too often? Is it even
> > possible to measure such a thing?
> > Put it another way - when is it safe to use, and when is it not? At
> > what point does it affect performance?
> > Of course, every site is different. So there probably isn't a hard and
> > fast rule.
> > But, switch_to_blog is a very useful tool. I use it for many things --
> > and when combined with things like transients and other caching, I
> > don't notice any performance problems.
> It becomes a problem when it becomes a problem, basically. :) There's
> no hard and fast rule.
> The thing is that it's tempting to use it stupidly, in loops and such.
> Like, if you wanted to get the latest 10 posts across a multisite
> setup, then one might try to loop through all the sites, get the
> latest posts from them, then order them up yourself. This might work
> fine if you have 4 sites, but when you have 40, or 400, or 4000, then
> the same code breaks miserably.
> So use it sparingly, basically. Probably not something you want to be
> doing on every page load.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
508-507-9673 | jesserfriedman at gmail.com
http://jesserfriedman.com | @professor <http://twitter.com/professor>
More information about the wp-hackers