On this page
insert_blog( string $domain, string $path, int $site_id ): int|false
This function has been deprecated. Use wp_insert_site() instead.
Store basic site info in the blogs table.
Description
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.
See also
Parameters
$domainstring Required-
The domain of the new site.
$pathstring Required-
The path of the new site.
$site_idint Required-
Unless you're running a multi-network install, be sure to set this value to 1.
Return
int|false The ID of the new row
Source
File: wp-includes/ms-deprecated.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_insert_site() wp-includes/ms-site.php | Inserts a new site into the database. |
| clean_blog_cache() wp-includes/ms-site.php | Clean the blog cache |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| create_empty_blog() wp-includes/ms-deprecated.php | Create an empty blog. |
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Use wp_insert_site() |
| MU (3.0.0) | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/insert_blog