function insert_blog($domain, $path, $site_id) {}

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.


  • string $domain: The domain of the new site.
  • string $path: The path of the new site.
  • int $site_id: Unless you’re running a multi-network install, be sure to set this value to 1.

Return values

returns:The ID of the new row

Source code

function insert_blog($domain, $path, $site_id) {

	global $wpdb;

	$path = trailingslashit($path);

	$site_id = (int) $site_id;

	$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );

	if ( ! $result )

		return false;


	return $wpdb->insert_id;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: