Resetting your website database can be useful if you are testing new plugins, themes or templates. If needed, you can delete the whole WordPress installation (files and database) and reinstall it, which is time-consuming. Fortunately, there are a couple of other methods to help you reach the same end faster and easier.

 

In this article, we’ll explain how to reset the database with the WordPress Database Reset plugin and WordPress CLI.


WordPress Database Reset Plugin

The WordPress Database Reset plugin is one of the most popular plugins for resetting the database.

Installing the Plugin

All the steps that are mentioned in this article require the WordPress Database Reset plugin. Therefore before following the steps, make sure that you have installed and activated the WordPress Database Reset plugin.

To install the WordPress Database Reset plugin:

1From the WordPress left menu, go to Plugins > Add New.

Resetting database - add new plugin

2Type WordPress Database Reset into the search plugins field. Related plugins will be listed. Find the WordPress Database Reset plugin and click on the Install Now button.

Resetting database - install plugin

3Click on Activate.

Resetting database - activate plugin

Resetting Database

After installing and activating the WordPress Database Reset plugin, you are ready to reset the database. This process will not delete your theme or plugin data. You will still be able to use the themes and plugins.

To reset the WordPress database:

1From the WordPress left menu, go to Tools > Database Reset.

Resetting database - database reset

2Select the database tables you would like to reset or click Select All. For example, if you have installed WooCommerce and don’t want to lose any product data, you can exclude WooCommerce tables by selecting the database tables manually. Also note that if you select the Users table, only the admin user will be restored.

Resetting database - select tables

3Enter the security code into the textbox, and click on the Reset Tables button.

Resetting database - security code

4Click on Ok to confirm.

WordPress CLI

WordPress CLI is a command line interface for managing WordPress. Its intended for developers so if you are not a developer, its best to use the above mentioned plugin.

If you have WordPress CLI installed, you can reset the database using the following command line:

wp reset database

You can even specify a list of table to reset:

wp reset database --tables='users, posts, comments, options'

The current theme and plugins will be reactivated by default. You can disable them like so:

wp reset database --no-reactivate

You can use the list command if you’re unsure of the database table names:

wp reset list