How to Delete Unused Database Tables in WordPress

How to Delete Unused Database Tables in WordPress Featured Image

When you install a plugin in WordPress, it automatically creates all the necessary folders, files, and database tables for it to work properly. However, when you deactivate and remove the same plugin, it may not delete the database tables along with the files and folders.

For instance, when I deactivated and deleted a plugin called Wordfence, it did not delete its more than twenty database tables along with the created files and folders.

wp-delete-plugin-db-tables-wordfence-database-tables

More often than not, plugin developers intentionally choose not to delete the plugin tables when you uninstall a plugin. There are many reasons for this behavior, but the most popular reason is to retain user settings, data, and other options within your database so that they can be restored when you reactivate the plugin.

Retaining settings and user data is a good thing. However, with all the plugins you install and uninstall over time, the database size may increase due to the leftover database tables. Moreover, any leftover plugin database table may prove to be a potential liability.

Here’s how to delete all those leftover database tables in WordPress with just a few clicks.

Also read: How to Set Up WordPress Using Docker in Ubuntu

Delete Leftover Plugin Database Tables

Note: Before making any changes, it is very important that you back up your WordPress database. The backup helps restore your site in the event of any unintended consequences. If necessary, back up your entire WordPress site, just to be sure.

For most things in WordPress, there is a plugin called Plugins Garbage Collector. It is specifically designed to find and delete leftover tables.

1. Open your WordPress dashboard and navigate to “Plugins -> Add new.” Search for the “Plugins Garbage Collector” plugin. From the search results, install and activate the plugin.

wp-delete-plugin-db-tables-install-activate-pgc-plugin

After activating the plugin, go to the “Tools -> Plugins Garbage Collector” page, select the “Search non-WP tables” radio option, and click on the “Scan Database” button.

wp-delete-plugin-db-tables-scan-database

After completing the scan, the plugin will display all the database tables that are not related to the core of WordPress or any of the installed plugins. Generally, these are the tables that are left over after deleting a plugin.

wp-delete-plugin-db-tables-left-over-database-table-list

There is no select all option for obvious reasons, so double check each and every table and manually select all the tables you want to delete. Then, scroll down and click on the “Delete Tables” button. Again, only press this button if you are sure and have a good database backup.

wp-delete-plugin-db-tables-click-delete-tables-button

If everything goes well, you’ve successfully deleted all the leftover plugin tables, and your site is still working as it should. While you are at it, you can use plugins like WP-Optimize to further clean and optimize your WordPress database.

wp-delete-plugin-db-tables-tables-deleted

Comment below sharing your thoughts and experiences regarding using this approach to delete unused and leftover plugin database tables in WordPress.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Vamsi Krishna Avatar

Read next

Content and cloud networks now account for three-quarters of used international bandwidth, while Google, Meta, Microsoft and Amazon own, co-own or buy capacity on a growing share of the 600-plus submarine cable systems carrying over 99 per cent of data between countries, a private map hidden below the wireless internet
Wi-Fi doesn’t actually slow down when a café gets crowded — the signal is fine, but every device has to wait its turn to speak on the same frequency, and the polite queuing is what you feel as lag
In 1988, a 23-year-old Cornell graduate student named Robert Morris released a self-replicating program to measure the size of the internet — within hours it had crashed roughly 6,000 of the 60,000 machines then online, and computer security became a field
In July 2026, Psy’s Gangnam Style passed six billion YouTube views, fourteen years after its horse-riding dance became the platform’s first billion-view video and long after engineers had replaced a counter designed to stop at 2,147,483,647
Suzanne Simard sealed paper birch and Douglas fir seedlings inside plastic bags, fed them carbon-14 and carbon-13 dioxide, and nine days later found carbon had crossed between species through fungal threads in the British Columbia soil beneath her boots
A species of jellyfish called Turritopsis dohrnii can revert its adult cells back to a juvenile polyp stage when injured or starving, effectively restarting its life cycle, and biologists have so far failed to identify any natural limit to how many times it can do this.
A Japanese man named Jiroemon Kimura, who lived to 116, was born in 1897 when Queen Victoria still ruled and died in 2013, meaning a single human life personally overlapped with the invention of the airplane, the atomic bomb, the internet, and Instagram
The Hollywood sign originally read HOLLYWOODLAND when it was built in 1923 as a real estate advertisement for a housing development, and it was only meant to stand for 18 months, but nobody ever got around to taking it down and the city eventually adopted it as a landmark