Switch language
wpseek on Twitter

A WordPress-centric search engine for devs and theme authors

insert_blog [ ]

insert_blog ( $domain, $path, $site_id )
  • (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.
  • (int) The ID of the new row
Defined at:

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.


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;

	$blog_id = $wpdb->insert_id;
	refresh_blog_details( $blog_id );


	return $blog_id;

Top Google Search Results

More ...

User Note(s)