WordPress.org

Ready to get started?Download WordPress

Codex

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

Function Reference/wpmu create blog

Contents

Description

Creates a new blog (multisite).

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 '/'.

Usage

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

Parameters

$domain
(string) (required) Domain name for blog.
Default: None
$path
(string) (required) Path to the blog.
Default: None
$title
(string) (required) Title for blog.
Default: None
$user_id
(int) (required) ID of blog administrator.
Default: None
$meta
(array) (optional) Array of blog meta (options).
Default: empty string
$site_id
(int) (optional) Site ID, if running multiple networks.
Default: 1

Returns

(WP_Error object|integer) 
Error object on failure or blog ID on success

Example


Actions

  • Fires action 'wpmu_new_blog' before return, passing the parameters $blog_id, $user_id, $domain, $path, $site_id, $meta

Notes

Change Log

Since: MU

Source File

wpmu_create_blog() is located in wp-includes/ms-functions.php

See also

See also index of Function Reference and index of Template Tags.
This page is marked as incomplete. You can help Codex by expanding it.