Running the API on the same site twice

I've noticed NBT clears out all site content when you run the nbt_api_copy_contents_to_new_blog function. I was hoping to run the function twice, once to clone default content from a specific default content site, and again to clone the theme-specific content/settings (changes based on what theme the user has selected from the registration screen).

Any suggestions on how I can pull this off?

  • Michael Bissett

    Hey @Steve, hope you're doing well this evening! :slight_smile:

    Hmm... one suggestion that comes to mind would be to combine New Blog Templates with our Multisite Content Copier plugin.

    Since it sounds like you're taking the programmatic route, you may be able to use the nbt_api_copy_contents_to_new_blog function to first copy over the theme options/settings, and then use the mcc_copy_items function inside of Multisite Content Copier to copy over the posts/pages from your default content template site.

    (you can find the mcc_copy_items function on line 47 of multisite-content-copier/api.php)

    Though with all of this, it does make me wonder... why not have the default content be available on all of the template sites in your network? And then just copy the posts/pages & the theme settings/content all in one go?

    Kind Regards,
    Michael

  • Steve

    I'll look into that plugin, thanks.

    But it would be nice to somehow prevent NBT from clearing out a site's content first so I could use the same plugin for both tasks.

    Though with all of this, it does make me wonder... why not have the default content be available on all of the template sites in your network? And then just copy the posts/pages & the theme settings/content all in one go?

    I have dozens of themes and hundreds of pages on the default 'content' site, there'd be too much work keeping the content in sync across all of the 'theme' sites.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.