• Resolved totzkie

    (@totzkie)


    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)
  • 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 in the Codex).

    (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

    (@totzkie)

    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. Please use the pastebin]

    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

    (@totzkie)

    ooh… im sorry.. i miss that part…

    Here is my sample code

    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)

    (@ipstenu)

    ?????? Advisor and Activist

    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

    (@totzkie)

    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)

    (@ipstenu)

    ?????? Advisor and Activist

    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

    (@totzkie)

    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.