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



insert_blog ›

Seit3.0.0
Veraltet5.1.0
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
Siehe:
Gibt zurück:
  • (int|false) The ID of the new row
Definiert in:
Codex:
Changelog:
  • MU

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) {
	_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;
}