What would cause wpmu_create_blog to throw “Already Installed” Error?

I have a production website https://toursoft.co which when we do dev work we move it to https://toursoft.us and do a database search replace to setup the dev environment. It's a multisite environment.

Calling `wpmu_create_blog()` programmatically throws the following error (it's actually not an error but returned HTML)

`Already Installed
You appear to have already installed WordPress. To reinstall please clear your old database tables first.`

Once this happens one time, it is no longer possible to create blogs in the system, even via Sites > Add New in the Network Admin area. The error continues to pop up.

On a woocommerce hook, we have custom code to create a new blog in the multisite programmatically, with this code: (this happens anywhere we add wpmu_create_blog, though so it's not specific to woocommerce)

$domain = get_post_meta( $order->get_id(), 'My Field', true );
$domain .= '.toursoft.us';
$path = "/";

// we've passed all validation checks up to this point so create the new site.
$new_blog_id = wpmu_create_blog($domain, $path, 'Adventure Tours', $subscription->get_customer_id());

Despite the error, an entry is made into wp_blogs database table. There is, however, _not_ an entry in wp_signups, and I'm not sure if that's relevant. Both site_id and signup_id are AUTOINCREMENT so I can't see where there is a clash should that be a consideration.

What is the code checking (or database entry) that causing that error or why would it be happening? How can I reverse it?

  • Panos

    Hi blue ,

    You can check if what is provided here:
    $domain = get_post_meta( $order->get_id(), 'My Field', true );
    is empty or already exists in the PREFIX_blogs table.

    Here is a sample I tested and worked on my side (I used static values for user_id and domain though):

    $title = 'Adventure Tours';
        $path = get_post_meta( $order->get_id(), 'My Field', true );
        $user_id = $subscription->get_customer_id();
        $domain = get_network()->domain;
        if ( is_subdomain_install() ) {
            $domain = stripslashes( $path ) . ".{$domain}";
            $path = '/';
            $path = "/" . stripslashes( $path ) . "/";
        $new_blog_id = wpmu_create_blog( $domain, $path, $title, $user_id );

    Hope this helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.