Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



insert_blog ›

SeitMU
Veraltetn/v
insert_blog ( $domain, $path, $site_id )
Parameter: (3)
  • (string) $domain The domain of the new site.
    Erforderlich: Ja
  • (string) $path The path of the new site.
    Erforderlich: Ja
  • (int) $site_id Unless you're running a multi-network install, be sure to set this value to 1.
    Erforderlich: Ja
Gibt zurück:
  • (int) The ID of the new row
Definiert in:
Codex:

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.



Quellcode

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 );

	wp_maybe_update_network_site_counts();

	return $blog_id;
}