Function and usage of confirm_blog_signup() in wordpress


Answers ( 1 )


    The confirm_blog_signup() function in WordPress is used during the site registration process, particularly for multisite installations. It displays a confirmation message indicating that a new site has been successfully registered and is pending activation. This function is typically invoked after a user has completed the site registration form, and it serves as a feedback mechanism to inform them that their site request is being processed.

    Function Signature:

    confirm_blog_signup( string $domain, string $path, string $blog_title, string $user_name = '', string $user_email = '', array $meta = array() )


    • $domain (string, required): The domain or subdomain of the site. This is the URL where the new site will be accessible.
    • $path (string, required): The path of the site. This is used to specify the directory or subdirectory structure of the site within the domain.
    • $blog_title (string, required): The title of the new site. This is typically displayed in the header or title bar of the site and is used for identification purposes.
    • $user_name (string, optional): The username of the user who is registering the site. Default value is an empty string.
    • $user_email (string, optional): The email address of the user registering the site. Default value is an empty string.
    • $meta (array, optional): Additional metadata from the 'add_signup_meta' filter in the validate_blog_signup() function. Default is an empty array. This can include various additional information associated with the site registration.

    Usage Example:

    Imagine a scenario where a user is registering a new site on a WordPress multisite network. Here's how confirm_blog_signup() might be used:

    // Sample values for site registration
    $domain = "";
    $path = "/newsite/";
    $blog_title = "My New WordPress Site";
    $user_name = "newuser";
    $user_email = "";
    $meta = array( 'additional_info' => 'Example meta data' );
    // Call the function to confirm the site signup
    confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);

    In this example, after the user submits their site registration form, confirm_blog_signup() is called with the details they provided. The function then displays a message to the user, indicating that their new site "My New WordPress Site" at has been registered under the username "newuser" and is awaiting activation. The $meta parameter can carry additional information if needed, which is defined by the 'add_signup_meta' filter in validate_blog_signup().

Leave an answer