Inspect wp-admin/network.php
and wp-admin/includes/schema.php
files. You can create a condition based on WP_INSTALLING_NETWORK
Update:
if (is_admin()){
/* First Step */
if (!defined( 'WP_ALLOW_MULTISITE')){
$current_wp_config = file_get_contents(ABSPATH . 'wp-config.php');
$my_defines = "/* First we put WP_ALLOW_MULTISITE */\r\n" .
"define('WP_ALLOW_MULTISITE', true); \r\n";
$current_wp_config = str_replace("/* That's all, stop editing", $my_defines . "/* That's all, stop editing", $current_wp_config);
file_put_contents(ABSPATH . 'wp-config.php', $current_wp_config);
}
/* Second Step */
if (!defined("WP_DEFINES_IMPORTED") && defined("WP_INSTALLING_NETWORK") && $_POST){
$current_wp_config = file_get_contents(ABSPATH . 'wp-config.php');
$my_defines = "/* Now we define */\r\n" .
"define('WP_DEFINES_IMPORTED', true); \r\n" .
"define('MULTISITE', true); \r\n".
"define('SUBDOMAIN_INSTALL', true); \r\n".
"define('DOMAIN_CURRENT_SITE', '". get_clean_basedomain() . "'); \r\n".
"define('PATH_CURRENT_SITE', '". parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ) . "'); \r\n".
"define('SITE_ID_CURRENT_SITE', 1); \r\n".
"define('BLOG_ID_CURRENT_SITE', 1); \r\n";
$current_wp_config = str_replace("/* That's all, stop editing", $my_defines . "/* That's all, stop editing", $current_wp_config);
file_put_contents(ABSPATH . 'wp-config.php', $current_wp_config);
}
}
- put this to mu-plugins folder.
- fresh wp install
- go to admin panel
- click to tools
- click to network setup
- run the setup
- ???
- profit!!!