Codex

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

Function Reference/wpmu create blog

This page redirects to an external site: https://developer.wordpress.org/reference/functions/wpmu_create_blog/

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

<code style="color: #000000"><span style="color: #0000BB"><?php wpmu_create_blog</span><span style="color: #007700">( </span><span style="color: #0000BB">$domain</span><span style="color: #007700">, </span><span style="color: #0000BB">$path</span><span style="color: #007700">, </span><span style="color: #0000BB">$title</span><span style="color: #007700">, </span><span style="color: #0000BB">$user_id</span><span style="color: #007700">, </span><span style="color: #0000BB">$meta</span><span style="color: #007700">, </span><span style="color: #0000BB">$site_id </span><span style="color: #007700">) </span><span style="color: #0000BB">?></span></code>

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.