wpmu_create_blog

SummerySummery

Create a site.

Syntax

wpmu_create_blog( string $domain, string $path, string $title, int $user_id, array $options = array(), int $network_id = 1 )

DescriptionDescription

This function runs when a user self-registers a new site as well as when a Super Admin creates a new site. Hook to ‘wpmu_new_blog’ for events that should affect all new sites.

On subdirectory installations, $domain is the same as the main site’s domain, and the path is the subdirectory name (eg ‘example.com’ and ‘/blog1/’). On subdomain installations, $domain is the new subdomain + root domain (eg ‘blog1.example.com’), and $path is ‘/’.

ParametersParameters

$domain

(string) (Required) The new site's domain.

$path

(string) (Required) The new site's path.

$title

(string) (Required) The new site's title.

$user_id

(int) (Required) The user ID of the new site's admin.

$options

(array) (Optional) Array of key=>value pairs used to set initial site options. If valid status keys are included ('public', 'archived', 'mature', 'spam', 'deleted', or 'lang_id') the given site status(es) will be updated. Otherwise, keys and values will be used to set options for the new site.

Default value: array()

$network_id

(int) (Optional) Network ID. Only relevant on multi-network installations.

Default value: 1

ReturnReturn

(int|WP_Error) Returns WP_Error object on failure, the new site ID on success.

SourceSource

File: wp-includes/ms-functions.php


			

ChangelogChangelog

Changelog
Version Description
MU (3.0.0) Introduced.
Scroll to Top