Using WordPress ‘confirm_blog_signup()’ PHP function

The confirm_blog_signup() WordPress PHP function shows a message confirming that a new site has been registered and is awaiting activation.

Usage

You can use this function to display a confirmation message after the registration of a new blog on your WordPress multisite network. Here’s a basic example:

confirm_blog_signup('mynewsite.example.com', '/blog/', 'My New Blog', 'newuser', '[email protected]');

In this example, the function would display a message confirming the registration of a new blog with the domain ‘mynewsite.example.com’, located at ‘/blog/’, titled ‘My New Blog’, and registered by the user ‘newuser’ with the email ‘[email protected]’.

Parameters

  • $domain (string) (Required) The domain or subdomain of the site.
  • $path (string) (Required) The path of the site.
  • $blog_title (string) (Required) The title of the new site.
  • $user_name (string) (Optional) The user’s username. Default: ”
  • $user_email (string) (Optional) The user’s email address. Default: ”
  • $meta (array) (Optional) Any additional meta from the ‘add_signup_meta’ filter in validate_blog_signup(). Default: array()

More information

See WordPress Developer Resources: confirm_blog_signup()

Examples

Basic Usage

The simplest way to use this function is to provide the required parameters only: domain, path, and blog title.

confirm_blog_signup('mynewsite.example.com', '/blog/', 'My New Blog');

This will display a confirmation message for a new site at ‘mynewsite.example.com/blog/’ titled ‘My New Blog’.

With User Details

You can provide user details to personalize the confirmation message.

confirm_blog_signup('mynewsite.example.com', '/blog/', 'My New Blog', 'newuser', '[email protected]');

This will display a confirmation message including the username and email of the user who registered the site.

With Additional Meta Data

Use the $meta parameter to include additional data from the ‘add_signup_meta’ filter in the validate_blog_signup() function.

$meta_data = array('key1' => 'value1', 'key2' => 'value2');
confirm_blog_signup('mynewsite.example.com', '/blog/', 'My New Blog', 'newuser', '[email protected]', $meta_data);

This will include the meta data in the confirmation message.

With Default Path

If your new site doesn’t require a specific path, you can use ‘/’ as the default.

confirm_blog_signup('mynewsite.example.com', '/', 'My New Blog', 'newuser', '[email protected]');

This will display a confirmation for a site located at the root of ‘mynewsite.example.com’.

Without User Details

If you don’t want to specify user details, you can leave those parameters empty.

confirm_blog_signup('mynewsite.example.com', '/blog/', 'My New Blog', '', '', array());

This will display a confirmation message without any user details.