insert_blog() – Store basic site info in the blogs table.

You appear to be a bot. Output may be restricted


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.


$int|false = insert_blog( $domain, $path, $site_id );


( string ) required – The domain of the new site.
( string ) required – The path of the new site.
( int ) required – Unless you're running a multi-network install, be sure to set this value to 1.


int|false The ID of the new row


File name: wordpress/wp-includes/ms-deprecated.php

1 to 18 of 18
function insert_blog($domain, $path, $site_id) {
  _deprecated_function( insert_blog, '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;

 View on GitHub View on Trac