Print

Cleanup and Delete Staging Sites

The regular way to delete a staging site is to use the delete button from the Sites / Start page

Sometimes you do not have the option to delete the staging site. For example, this can happen if you activate the WP Staging setting “Remove Data on Uninstall” and uninstall WP Staging before deleting the staging site by using the regular delete button.

In that case, WP Staging looses the connection to the staging site and you need to delete the testing site manually by the steps below.

The other reason why you might do not have the option to delete a staging site is when the cloning process has been interrupted accidentally. In that case, it’s possible that data from an unfinished site is still in the database and folder of your production site. For the moment you need to delete that data manually as well.

Delete Database Data

To delete the staging site log in to your database with the software phpmyadmin or adminer and delete all tables which do not belong to one of your existing staging sites. For instance, that can be all tables that start with the prefix wpstg1_

Instead of deleting all tables one by one you can use the SQL query below which creates a new query that you can use to delete all tables at once:

SELECT CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'wpstg0_%'
or TABLE_NAME LIKE 'wpstgtmp_%'
or TABLE_NAME LIKE 'wpstg0_%'
or TABLE_NAME LIKE 'wpstg1_%'
or TABLE_NAME LIKE 'wpstg2_%'
or TABLE_NAME LIKE 'wpstg3_%'
or TABLE_NAME LIKE 'wpstg4_%'
or TABLE_NAME LIKE 'wpstg5_%'
or TABLE_NAME LIKE 'wpstg6_%'
or TABLE_NAME LIKE 'wpstg7_%'
or TABLE_NAME LIKE 'wpstg8_%'
or TABLE_NAME LIKE 'wpstg9_%'
or TABLE_NAME LIKE 'wpstg10_%'
or TABLE_NAME LIKE 'wpstg11_%'
or TABLE_NAME LIKE 'wpstg12_%'
or TABLE_NAME LIKE 'wpstg13_%'
or TABLE_NAME LIKE 'wpstg14_%'
AND TABLE_SCHEMA = 'DATABASENAME';

This creates a new SQL query that deletes all tables which begin with the prefixes,wpstg0_ wpstg1_ and  wpstg2_

DROP TABLE DATABASENAME.wpstg1_options;
DROP TABLE DATABASENAME.wpstg1_postmeta;
DROP TABLE DATABASENAME.wpstg1_posts;

In the future, WP Staging will be able to clean up those unused tables automatically but for now, this little extra work is needed.

Delete Files

Also, check if the plugin has been created a subfolder in the root path of your production site. You need to delete that folder as well: