我有一个多站点Wordpress安装,我想通过via服务连接到另一个应用程序。我得到了一个用户列表,我需要自动创建网站。我不知道该怎么做。如有任何建议,将不胜感激。谢谢。
发布于 2014-08-24 18:43:19
这在内部由WordPress使用名为/wp-admin/network/site-new.php
的文件通过调用wpmu_create_blog()
函数来处理。
global $wpdb;
$domain = 'example.com'; // your domain (or subdomain)
$path = '/blog'; // path to your site
$title = 'My Site'; // site title
$user_id = get_current_user_id(); // the user id that owns this site
// hide db errors
$wpdb->hide_errors();
// create the new site
$id = wpmu_create_blog( $domain, $path, $title, $user_id , array( 'public' => true ) );
// enable db errors
$wpdb->show_errors();
https://stackoverflow.com/questions/25474978
复制相似问题