How to recover deleted site in WordPress Multisite?

I went to Network Admin > Sites > clicked on a site and changed the site url for a child site. Now that site is gone altogether and I cannot get it back. What can I do now?

Related posts

Leave a Reply

1 comment

  1. http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/includes/ms.php#L46

    Notice, how drop defaults to false; this means that the blog tables are not removed. Deleting is triggered from over here: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/ms-delete-site.php#L19 and nowhere else by default. Unless you have a plugin that forces drops on the tables there’s still a chance to recover something.

    First of all backup the database before attempting anything.

    To get the blog to be displayed in the list you have to reverse the following action:

    update_blog_status( $blog_id, 'deleted', 1 );
    

    You can do this manually via MySQL:

    UPDATE `wp_blogs` SET `deleted` = 0 WHERE `blog_id` = '##'
    

    Or update_blog_status( ##, 'deleted', 0 ); in your functions.php once.

    The users will, unfortunately be gone, due to this in a loop:

    remove_user_from_blog( $user_id, $blog_id );
    

    …performing even if the tables aren’t dropped.

    The rest – settings, files, etc. should be all intact.

    Good luck.