Title: Programatically Add New Site
Last modified: August 20, 2016

---

# Programatically Add New Site

 *  Resolved [totzkie](https://wordpress.org/support/users/totzkie/)
 * (@totzkie)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/programatically-add-new-site/)
 * Hi guys… is anyone can give a sample code on how to programmatically Add New 
   Site in wordpress multisite? in short… the code can be embeded in a plugin. Thanks..

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Rod Whiteley](https://wordpress.org/support/users/rod-whiteley/)
 * (@rod-whiteley)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2506933)
 * Perhaps it will help you to look in `wp-admin/network/site-new.php` to see how
   it does it, and also in `wp-includes/ms-functions.php` to examine the function`
   wpmu_create_blog` (which sadly tells you more than reading [wpmu_create_blog](http://codex.wordpress.org/WPMU_Functions/wpmu_create_blog)
   in the Codex).
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2506939)
 * (the codex is editable by anyone who has a login to the forums here 😉 Feel free
   to spiff that page up if the spirit moves you.)
 *  Thread Starter [totzkie](https://wordpress.org/support/users/totzkie/)
 * (@totzkie)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2506984)
 * Hi Rod Whiteley.. thanks to you… I’d tried the **site-new.php** codes insert 
   into my plugin function and edit some stuff without further understanding the
   codes due to my poor experience. but its succesfully add another site.. but I
   have another problem regarding in programmatically adding page inside this function.
   I want in my plugin function to add new site and add new page simultaneously.
 * **Here is my sample code**
    _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * Its successfully add new site but it didn’t add new page.
 * Pls help me to solve this… need to finish this ASAP… Thanks in advance..
 *  Thread Starter [totzkie](https://wordpress.org/support/users/totzkie/)
 * (@totzkie)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507009)
 * ooh… im sorry.. i miss that part…
 * [Here is my sample code](http://pastebin.com/PkR6Szjk)
 * I commented the codes for creating pages…
 * **Another concern:** Is there’s a way to programmatically activate the plugin
   instead of user manually click it? is somebody done this before? because the 
   codes for creating pages were successfully work when I activate my plugin from
   the new site that I’d created. but I want it to navigate automatically.
 * please notify me if I’ve done wrong… I really need help for this project.. thanks
   again in advance.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507011)
 * >  Is there’s a way to programmatically activate the plugin instead of user manually
   > click it?
 * Yes. Network activate a plugin and it is, by default, on for all sites. And they
   can’t turn it off.
 * _CAVEAT_ – Not all plugins will work when you do that.
 *  Thread Starter [totzkie](https://wordpress.org/support/users/totzkie/)
 * (@totzkie)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507012)
 * do you know how to do it via code? what I want is to automatically activate my
   plugin in the newly site that I had created when I attempt to add new site.. 
   I do searching and all i found out is for single site WordPress and try it into
   multisite but it didn’t work.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507013)
 * You misunderstand.
 * Install the plugin on the network.
 * Network Activate it.
 * It will magically be on for all sites, past and future.
 * No further work needs be done.
 *  Thread Starter [totzkie](https://wordpress.org/support/users/totzkie/)
 * (@totzkie)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507014)
 * ooh… I got it past 20mins ago…I’ve never seen the network activate earlier… thanks
   to you and more power..

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Programatically Add New Site’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 8 replies
 * 4 participants
 * Last reply from: [totzkie](https://wordpress.org/support/users/totzkie/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/programatically-add-new-site/#post-2507014)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
