The regular way to delete a staging site is to use the delete button from the Sites / Start page
It may happen that you do not have the option to delete the staging site. For example, this can happen if you’ve activated the WP Staging setting “Remove Data on Uninstall” and uninstalled WP Staging before deleting the staging site by using the intended delete button.
In that case, WP Staging loses 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.
Another reason for a missing staging site is when you restored your website with a prior back up which has been done before creating the staging site. So this backup would miss the connection data to the staging site.
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
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,
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.
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:
After doing that, nothing is left and the staging site has been deleted immediately.