开发者

Wordpress Multi Site (Networking enabled)

开发者 https://www.devze.com 2023-02-17 00:36 出处:网络
I want to programatically create a Blog/Site in Wordpress Muti site (Networking enabled wordpres). Is there any API to do that? If Not, Can I directly insert the data i开发者_运维技巧nto the data base

I want to programatically create a Blog/Site in Wordpress Muti site (Networking enabled wordpres). Is there any API to do that? If Not, Can I directly insert the data i开发者_运维技巧nto the data base?

I want to create a wordpress site based on one of my custom registration forms from a php page. Any Help/Links to the documentation will be appreciated. Thank you.


this works for sub directory installs:

global $current_site;
wpmu_create_blog( $current_site->domain, $current_site->path . 'mysite/', 'My Site', 1 );

and this should work for sub domain installs:

global $current_site, $base;
wpmu_create_blog( 'mysite.mydomain.com', $base, 'My Site', 1 );

if you need to add a blog with and a user at the same time, check out the code in /wp-admin/ms-edit.php around where it says 'case 'addblog':' on line 139. THere is code to sanitze the domain, following there is code to add a new user from an email.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号