[wp-hackers] Cloning content from Master site into new sites on a WP Network

Jesse Friedman highfive at jesserfriedman.com
Wed Jul 11 19:38:41 UTC 2012


The content is already made and exists in the Master site. I want to clone
it from there into the new site.

Jesse

On Wed, Jul 11, 2012 at 3:24 PM, Mika A Epstein <ipstenu at ipstenu.org> wrote:

> Do you want to clone, or push to both sites at the same time? There are
> plugins that will publish to multiple blogs at once (broadcast plugins
> etc). While they seem to only do normal posts, I'm sure you could fork them
> to do your CPTs :)
>
>
>
> On Jul 11, 2012, at 2:17 PM, Jesse Friedman <highfive at jesserfriedman.com>
> wrote:
>
> > Thanks Otto
> >
> > It's only when someone creates a new site.  At this current rate I'd be
> > thrilled if it were happening 15 times a day.
> >
> > Jesse
> >
> > On Wed, Jul 11, 2012 at 3:10 PM, Otto <otto at ottodestruct.com> wrote:
> >
> >> If this is a one-time thing, or something that they're not going to do
> >> a whole lot, then you can use switch_to_blog and restore_current_blog.
> >>
> >> Example:
> >>
> >> switch_to_blog(1); // id number of the blog
> >> .. do the stuff to get the post data you need here..
> >> restore_current_blog();
> >> .. loop to insert that data as posts or whatever...
> >>
> >> The problem with switch_to_blog is that it has a fair amount of
> >> overhead, and so you shouldn't do it too often or unnecessarily.
> >>
> >> -Otto
> >>
> >>
> >> On Wed, Jul 11, 2012 at 1:56 PM, Jesse Friedman
> >> <highfive at jesserfriedman.com> wrote:
> >>> Hello All
> >>>
> >>> What's the best way to grab posts, pages, CPT's from a Master (top
> level)
> >>> site in a WP Network and clone it into another site?
> >>>
> >>> I've created a page template from wp-signup.php to alter the "Add New
> >> Blog"
> >>> form.  Now the form query's all the "Products" custom posts in the
> Master
> >>> Site and displays them as checkboxes.  The goal here is that when a new
> >>> site is added to the network a potential admin can select the products
> >> they
> >>> offer from a Master list of products and that content (currently
> existing
> >>> in the Master Site) will be duplicated into the new site.
> >>>
> >>> My question is should I be using wp_insert_post().  Since I have the
> id's
> >>> of all the CPT's in the master site and the ones that the admin has
> >>> selected it'd be easy enough to loop through the info and use
> >>> wp_insert_post to insert the posts into the new site.  The problem is I
> >>> can't seem to define the site id of the new site with wp_insert_post().
> >>>
> >>> thanks for the help
> >>>
> >>> Jesse
> >>> _______________________________________________
> >>> wp-hackers mailing list
> >>> wp-hackers at lists.automattic.com
> >>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >
> >
> >
> > --
> > thanks,
> >
> > *Jesse Friedman*
> > 508-507-9673 | jesserfriedman at gmail.com
> > http://jesserfriedman.com | @professor <http://twitter.com/professor>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
thanks,

*Jesse Friedman*
508-507-9673 | jesserfriedman at gmail.com
http://jesserfriedman.com | @professor <http://twitter.com/professor>


More information about the wp-hackers mailing list