Store basic site info in the blogs table.
This function creates a row in the wp_blogs table and returns the new blog’s ID. It is the first step in creating a new blog.
$domainstringrequired
$pathstringrequired
$site_idintrequired
function insert_blog($domain, $path, $site_id) {
_deprecated_function( __FUNCTION__, '5.1.0', 'wp_insert_site()' );
$data = array(
'domain' => $domain,
'path' => $path,
'site_id' => $site_id,
);
$site_id = wp_insert_site( $data );
if ( is_wp_error( $site_id ) ) {
return false;
}
clean_blog_cache( $site_id );
return $site_id;
}
| Version | Description |
|---|---|
| 5.1.0 | Use wp_insert_site() |
| MU (3.0.0) | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/insert_blog