WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

WPMU Functions/wpmu create blog

Description

Creates a new blog (site).

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 installs, $domain is the same as the main site's domain, and the path is the subdirectory name (eg 'example.com' and '/blog1/'). On subdomain installs, $domain is the new subdomain + root domain (eg 'blog1.example.com'), and $path is '/'.

Uses: domain_exists() , insert_blog() , wp_install_defaults() , add_user_to_blog()

Parameters

$domain
(string) (required) The domain of the new blog.
Default: None
$path
(string) (required) The path of the new blog.
Default: None
$title
(string) (required) The title of the new blog.
Default: None
$user_id
(integer) (required) The user id of the user account who will be the blog admin.
Default: None
$meta
(object) (optional) Other meta information.
Default: [blank string]
$site_id
(string) (optional) The site_id of the blog to be created.
Default: 1

Return Values

(mixed) 
  • If successful, returns the id of the blog created
  • If fails returns a WP_Error object

Usage

<?php wpmu_create_blog($domain$path$title$user_id$meta$site_id); ?>