0 votes
83 views
by (1.5k points)

1 Answer

0 votes
by (10.3k points)

To delete a site from a WordPress Multisite along with its data tables and media/uploads, follow these steps carefully:

1. Backup the Site and Database
Before proceeding, it is highly recommended to back up your WordPress database and media files. You can use a plugin like UpdraftPlus or All-in-One WP Migration, or manually download files and export the database through phpMyAdmin.

2. Delete the Site from the Network Admin
1. Login to the Network Admin Dashboard:
   - Go to your WordPress Multisite Network Admin by logging into your admin dashboard and clicking My Sites > Network Admin > Sites.

2. Navigate to Sites:
   - In the Network Admin, go to Sites > All Sites.

3. Delete the Site:
   - Find the site you want to delete.
   - Hover over the site’s name, and click "Delete".
   - Confirm the deletion when prompted.

3. Remove Site-Specific Tables from the Database
Each site in a WordPress Multisite installation has its own set of database tables. After deleting the site from the admin dashboard, its tables remain in the database, and you’ll need to remove them manually.

1. Access phpMyAdmin or Your Database:
   - Log in to phpMyAdmin or your preferred database management tool.

2. Find and Delete the Site's Tables:
   - Each site in a WordPress Multisite has its own tables prefixed by the site’s blog ID. For example, the main site uses the prefix `wp_`, and additional sites use `wp_2_`, `wp_3_`, etc.
   - Look for the tables associated with the site’s blog ID (e.g., `wp_2_` for site ID 2).
   - Delete the following tables associated with the site:
     - `wp_x_posts`
     - `wp_x_postmeta`
     - `wp_x_comments`
     - `wp_x_commentmeta`
     - `wp_x_options`
     - `wp_x_terms`
     - `wp_x_term_relationships`
     - `wp_x_term_taxonomy`
     - `wp_x_users` (though user data is shared, so this table might not always exist)

3. Delete Site Metadata:
   - In the `wp_sitemeta` and `wp_blogmeta` tables, you can find metadata related to the site. Search for rows with the blog ID of the deleted site and remove them.

4. Delete Site’s Media and Uploads
After removing the site and its database tables, you should also delete the media files associated with the site from the server.

1. Access the WordPress Uploads Directory:
   - Using FTP, SFTP, or your hosting file manager, navigate to your site's wp-content/uploads/sites/ folder.

2. Delete the Site’s Uploads Folder:
   - Each site in a WordPress Multisite has its own directory within `uploads/sites/`. For example, site ID 2 will have a folder named `/wp-content/uploads/sites/2/`.
   - Find the folder corresponding to the deleted site and delete it.

5. Clear Cache (If Applicable)
If you're using caching (e.g., with plugins like WP Super Cache, W3 Total Cache, etc.), ensure you clear the cache to avoid any remnants of the deleted site appearing.

Summary of Steps:
1. Backup your database and media files.
2. Delete the site from the Network Admin dashboard.
3. Manually remove the site’s tables from the database via phpMyAdmin.
4. Delete the site’s media/uploads from the wp-content/uploads/sites/ folder.
5. Clear cache (if needed).

By following these steps, you can safely and completely remove a site from your WordPress Multisite installation along with its associated data.

...