How To Delete WordPress Plugin Data From Database After Delete WordPress Plugin

The removal of the WordPress plugin is very easy, you can remove it just by clicking the Delete link under the plugin on the WordPress plugin list page. But what you do not know is that the plugin may leave some tables in your MySQL database, and these tables may have a large size which will influence your MySQL performance largely. So, you have to remove the left plugin database tables in the MySQL database manually. This article will tell you how to do it.

 1. Remove WordPress Plugin Left DB Tables Steps.

  1. Open your WordPress website used MySQL database in phpMyAdmin.
  2. Expand the database and list all the tables under it.
  3. If you know which tables are left by the deleted plugin, you can just delete it easily.
  4. But what often happens is that you do not know which tables are left by that removed plugin, so you need to find out the tables left by that plugin.

2. Find Out Removed WordPress Plugin Left MySQL DB Tables.

  1. First, you should know the plugin name and go to it’s official website.
  2. In this example the removed plugin name is top 10, then I search keywords “WordPress plugin top 10” in google to get its official website.
  3. Or you can search the plugin name top 10 in https://wordpress.org/plugins/ to get it’s introduction page.
  4. Commonly you can find it’s Github repository URL address on the plugin introduction page.
  5. Then I guess that the table name with top_ten may be the tables that the plugin top ten left, so I go to the plugin’s Github repository and search top_ten in the plugin Github repository source code.
  6. You should click top_ten in this repository button in the search box drop-down list, otherwise, you can not search it out.
  7. The searched-out result confirms what I guess is correct. Two tables top_ten and top_ten_daily are used in the plugin source code /uninstall.php file as below.
    <?php
    /**
     * Update counts to database.
     *
     * @package   Top_Ten
     * @author    Ajay D'Souza <[email protected]>
    if ( $tptn_settings['uninstall_clean_tables'] ) {
    
        $table_name       = $wpdb->base_prefix . 'top_ten';
        $table_name_daily = $wpdb->base_prefix . 'top_ten_daily';
  8. So I remove the two tables *_top_ten, *_top_ten_daily. And the table _top_ten_daily is very big.
  9. If you do not know the plugin name, and you guess some tables are not used forever, you can search that table name in Github repository source code or google.
  10. If you guess some tables are left by some deleted WordPress plugins, and you can not confirm it, you can change the table name by adding a prefix such as del-verify-, and if there are no errors after a long time test, you can remove it finally. If there are any errors, you can change them back by removing the table prefix at any time.
  11. The principle is that you can Remove the large-sized tables which you have confirmed are used by the deleted plugin and not used by other plugins. If you are not sure whether the table is left by a deleted plugin and the table size is small, you can add a prefix to it and monitor it.
  12. Below is the deleted plugin left unused tables on my website.
  13. Plugin Top 10 : *_top_ten, *_top_ten_daily.
  14. Plugin Download Monitor : *_dlm_order, *_dlm_order_customer, *_dlm_order_item, *_dlm_order_transaction, dlm_session, *_download_log.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.