A straightforward way to delete a WP Staging staging site is to go to Actions > Delete and confirm the deletion of the whole staging site. This will delete all the files and the connected database tables on the staging site.
But sometimes, 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 you might not be able to delete a staging site is that the cloning process has been interrupted accidentally. In that case, data from an unfinished created website maybe still in the database and subfolder 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 restore your website with a prior backup before creating the site. So this backup would miss the connection data to the staging site.
Delete Database Data in Tables
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 to delete all tables at once:
SELECT CONCAT('DROP TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';')
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_%'
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 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 entirely.