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

Function Reference/wpmu create blog


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


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


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


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



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


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.