Resetting your site to an empty WordPress installation

Sometimes you may want to start your site development over from square one. Here's how to reset your existing site to an empty WordPress installation.

WARNING: this will delete all your content, themes and plugins, so make sure you have backups of all important data before doing this

wp-backup

Delete everything from the database

WordPress will save the sites content in the database. The following command will empty the tables that have content. NOTE! The command will not delete the sites user information like usernames and passwords.

echo "truncate table wp_posts; truncate table wp_comments; truncate table wp_commentmeta; truncate table wp_links; truncate table wp_terms; truncate table wp_termmeta;" | mysql

Delete all themes, plugins and media files

cd ~/htdocs/wp-content
rm -rf {themes,uploads,plugins}/*

Reinstall the default theme and plugins.

wp plugin install auto-post-thumbnail google-analytics-dashboard-for-wp
wp theme install --activate twentyseventeen

Finally, wipe the cache.

wp-purge-cache

Reload your site in the browser. You should now see an empty site with default twentyseventeen theme.

 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.