Uninstall Plugins

ALSO BELOW: https://premium.wpmudev.org/blog/how-to-fully-uninstall-a-wordpress-plugin/

https://kinsta.com/blog/uninstall-wordpress-plugin/

[code style=”css”]
// Replace pluginname with the plugin you have removed
select * from wp_options where option_name like "%pluginname%";
delete from wp_options where option_name like "%pluginname%";

select * from wp_usermeta where meta_key like "%pluginname%";
delete from wp_usermeta where meta_key like "%pluginname%";

select * from wp_postmeta where meta_key like "%pluginname%";
delete from wp_postmeta where meta_key like "%pluginname%";

select * from wp_commentmeta where meta_key like "%pluginname%";
[/code]

GOOD PLUGIN::

https://wordpress.org/plugins/advanced-database-cleaner/

SEE: https://the.shawneee.com/faq-wordpress-advanced-database-cleaner

https://wordpress.org/plugins/rvg-optimize-database/

How to Uninstall a WordPress Plugin (the Proper Way)

By Brian Jackson

Updated on October 9, 2019

With over 50,000 WordPress plugins on the repository alone, it’s more than likely you’ll test out and compare a few different ones to accomplish tasks or solve problems on your site. When you’re done with one, you simply uninstall it by deactivating and deleting it right? Wrong, the issue with doing it this way is that it can leave behind tables and rows in your WordPress database, and over time this can add up quite quickly, which in turn can affect your site’s performance and even cost you money on disk space. Today we are going to show you a few tips on how to uninstall a WordPress plugin the proper way to ensure your database stays small and snappy.

How to Uninstall a WordPress Plugin in the Dashboard

Before we dive into how to properly uninstall a WordPress plugin, lets first discuss the typical ways users delete plugins in WordPress. The first is simply from the dashboard. Follow the steps below to uninstall a WordPress the normal way (without removing data).

Step 1

Navigate to “Installed Plugins” in your dashboard and click on “Deactivate” next to the plugin. In this example, we are uninstalling the Wordfence security plugin.

Deactivate WordPress plugin

Step 2

The last step is to simply click on “Delete.”

Delete WordPress plugin

How to Uninstall a WordPress Plugin via FTP

The second common method users utilize is to uninstall plugins via FTP (without removing data). Follow the steps below.

Step 1

Connect to your WordPress site via SFTP.

Step 2

Browse to your /wp-content/plugins/ folder. Then delete the plugin folder from your server.
Delete WordPress plugin via FTP
Pretty simple right? Well, in most cases the above methods are the wrong way to go about uninstalling plugins, especially if you are never going to use the plugin again.

The Big Issue with Uninstalling WordPress Plugins

Whenever you install a WordPress plugin or theme, it stores the data in the database. The problem is that when you delete a plugin using one of the simple methods shown above, it typically leaves behind tables and rows in your database. Over time this can add up to a lot of data and even begin to slow your site down. In our example, we uninstalled the Wordfence security plugin, and it left behind 24 tables in our database (as seen below)!

Wordfence tables left behind after deleting the plugin

And besides the database, a lot of plugins also leave behind additional folders and files. In our experience, this is commonly seen with security and caching plugins which create additional directories for logging. For example, after the Wordfence plugin was deleted, we were left with a “wflogs” folder in our wp-content directory. And we aren’t trying to pick on Wordfence, the majority of plugins and themes on the market work this way.


Wordfence logs

If you have been uninstalling plugins using the simple methods above, unfortunately, there is probably a lot of clean up that needs to be done on your WordPress site. Remember that deactivating a plugin only makes it inactive. How many inactive plugins do you currently have on your site? If it is more than the number that is active, that probably isn’t a good thing. You should think about completely removing inactive plugins as they can still introduce security risks, even if not running, and simply leave bloat in your database.

Why Do Developers Do This?

So you are probably wondering, why don’t developers have self-cleanup options when you uninstall and delete a plugin? Well, in fact, they do. But, here are a couple reasons why they probably aren’t as obvious right off the bat.

They Want to Retain Settings for the User

The first reason is that a lot of WordPress users bounce between plugins frequently, and by leaving the tables and rows behind in your database, this retains your settings. This means that you can reinstall the plugin at a later time and all your data will still be there. Or if for some reason the plugin gets deleted by accident, you don’t have to panic. For less tech-savvy users, this could definitely be seen as a benefit, however, it isn’t the most efficient way.
But if for some reason you think you might return to a plugin later on, then yes, simply deleting the plugin using one of the above methods is the best route.

They Don’t Care About Performance

Unfortunately, another reason we have seen is that some developers might argue that leaving tables behind doesn’t affect the performance of your site. But imagine a site over the course of 10 years, having used hundreds of plugins, that have generated possibly thousands of rows or tables. Database queries have a large impact on your WordPress site’s performance, and plugins can make a lot of these requests if the developer wasn’t careful. Generally, a well-written plugin should only query the tables or rows in which it is tied to, however, this is not always the case.
We’ve seen this first hand at Kinsta, long database queries bringing a site to crawl due to unnecessary autoloaded data in the wp_options table which has been left behind.
And then there is the issue of disk space. Most web hosts charge by the amount of disk space you use or have limits in place, and that includes your database.

They Made a Mistake

The WordPress plugin handbook is made for developers along with best practices on how to deactivate a plugin vs uninstalling a plugin (remove data). Even it says:

Less experienced developers sometimes make the mistake of using the deactivation hook for this purpose.

If this mistake is made by the developer it means when the uninstall should have removed all of the data, it simply ran the deactivation process, leaving everything behind.

A Majority Do Have Cleanup Methods

However, there is good news, because a lot of them actually do have a way to do a proper cleanup, you probably just aren’t using them. However, with that being said, a lot of them still don’t make it clear enough to users how to properly uninstall their plugin. Kevin Muldoon, an internet marketer and blogger, recently touched on this very subject in his post on why WordPress.org needs to make uninstall options compulsory. In an ideal world, when you go to uninstall a WordPress plugin, it should prompt you with three different options.

  • Delete plugin
  • Delete plugin and data
  • Delete plugin, data, and settings (full removal)

But that is not quite how things work yet. It would be nice to eventually see something like this required in the repository.

How to Uninstall a WordPress Plugin (the Proper Way)

Today we are going to show you a few recommendations and tricks on how to uninstall a WordPress theme and/or plugin the proper way. This could include everything from using the developer’s optional full removal process or having to do a self-cleanup in the database.

Step 1

In this example, we are going to continue using the Wordfence plugin. One of the troubles with uninstalling a WordPress plugin the proper way is that each developer treats this a little differently. This means, most likely you will need to do a quick Google search, check the developer’s documentation on their site, or shoot them a quick email. As you can see below we Googled “how to uninstall wordfence” and the first thing that returned was just that, their official docs on how to remove Wordfence completely.

How to uninstall Wordfence

Step 2

A well-developed plugin should include an option in their plugin’s settings to do a complete uninstall. You can see an example of this below with the popular Gravity Forms plugin. A quick click of the “Uninstall Gravity Forms” button and all the tables and data are gone.

Uninstall Gravity Forms

Here is another example on the Polylang multilingual plugin. You can see under their Tools section there is an option to remove all the data when using the “Delete” link. It has to simply be enabled first.


Polylang remove plugin data

If you don’t uninstall multilingual plugins the correct way, they will keep unnecessarily updating translation data for other third-party plugins, even after they have been removed.


Weirdly enough Wordfence recommends you install another plugin, the Wordfence Assistant, which will help completely remove the plugin, data, and settings. As you can see below, once the plugin is installed there are options to delete the Wordfence data and tables, clear all locked out IPs, and live traffic data.


Remove WordFence completely

Other WordPress plugins might require an even more complex uninstall process, such as WooCommerce, in which you have to put the following code in your wp-config.php file before deleting it to completely remove all the data.

define( 'WC_REMOVE_ALL_DATA', true);

But this is why it is important before you simply deactivate and delete a plugin, that you ensure you are doing it in the most efficient manner. Here are shortcuts to uninstall guides for some popular WordPress plugins that some people sometimes have issues with:

Removing Unused Shortcodes

If you are using a plugin that utilizes shortcodes and you delete and or remove that plugin, your site could look really weird until you replace them. If you want to temporarily disable the shortcodes from the old plugin, simply use the following code in your functions.php file. Updating ‘pluginshortcode’ with the actual plugin’s tag.

add_shortcode( 'pluginshortcode', '__return_false' );

This will disable them from showing altogether. But remember, if you want to use them with the original plugin again, you would need to remove the code. However, it can be a quick way to clean up your site while you replace the shortcodes with perhaps a newer plugin’s shortcode format.

How to Manually Cleanup Tables Left Behind by Plugins

There will probably be times in which you have already uninstalled a plugin and you are simply needing to do a cleanup. Or perhaps the developer’s full removal method is actually referencing that you remove the database tables manually. There are a couple ways you can approach this, one is by using a table cleanup plugin, and the other is to remove the tables directly within phpMyAdmin.
In both of these approaches, we highly recommend that you take a backup beforehand. If you are a Kinsta user you can easily create a backup in the MyKinsta dashboard with one-click.

Create WordPress backup
Or utilize one of many popular WordPress backup plugins.

Cleanup Tables with Plugin

Your best option for a plugin is probably the Advanced Database Cleaner. This is a premium plugin, but it can scan your WordPress installation and allow you to delete orphaned tables. As you can see below it picked up the EDD (wp_edd*), Gravity Forms (wp_gf*), and Bloom (et_bloom*, et_social*) tables from plugins that were no longer installed.

EWWWW OPTIMIZER – CANNOT REMOVE POSTMETA FROM OLD PLUGIN::
https://wordpress.org/support/topic/completely-remove-this-plugin/

REVOLUTION SLIDER::

wp_revslider_css
wp_revslider_layer_animations
wp_revslider_navigations
wp_revslider_sliders
wp_revslider_slides
wp_revslider_static_slides

However if you delete the plugin from dashboard (not from file manager) then these tables should be deleted.

WP-ALL-IMPORT / WP-ALL-EXPORT PLUGIN:

The tables are:
wp_pmxi_files
wp_pmxi_history
wp_pmxi_imports
wp_pmxi_posts
wp_pmxi_templates
and there are also entries in WP _options.

Can I delete everything without problems?

Yeah you can remove them. Those tables are the history & saved templates of exported/imported of posts/images.

ADROTATE PLUGIN::

Do I just delete the plugin and delete all the following tables from the db?

wp_adrotate
wp_adrotate_groups
wp_adrotate_linkmeta
wp_adrotate_schedule
wp_adrotate_stats
wp_adrotate_stats_archive
wp_adrotate_tracker
wp_adrotate_transactions

wp_adrotate_tracker for example has almost 70 million rows, and it is taking a toll on my db backups it looks like.

Please let me know if I need to do anything else to completely delete it. Thanks.

DeveloperDeveloperDeveloper
AdRotate has a uninstall script via the dashboard if you de-activate and delete.

But if the only issue is your tracker table clogging up you may want to look at the AdRotate Settings > Maintenance tab and see if all cleanup schedules are running.

If not, re-activate the plugin to re-instate those schedules.

Most common db tables of WP Important & Export;

wp_pmxe_exports
wp_pmxe_google_cats
wp_pmxe_posts
wp_pmxe_templates
wp_pmxi_files
wp_pmxi_history
wp_pmxi_images
wp_pmxi_imports
wp_pmxi_posts
wp_pmxi_templates

But I still suggest you to backup the database before cleaning.

Detect orphaned tables

Cleanup Tables in phpMyAdmin

You can also cleanup the tables manually in phpMyAdmin. We actually prefer this method over using a plugin. A lot of plugins will name their tables something similar to the name of their plugin. In this example, we are going to completely remove Yoast SEO according to their documentation. In fact, Yoast SEO doesn’t have an option in their plugin for this, if you want to completely uninstall it and remove the data your only alternative is doing it in phpMyAdmin. In their documentation that they state:

If you want to remove all traces of our plugins, please search the database for entries containing wpseo and manually remove the data.

To do this simply login to phpMyAdmin. Under the “Search” tab input “wpseo,” select all the tables, and click on “Go.”


Search wpseo in database

On our site there were matches found in the the wp_options table, the wp_postmeta table, and the wp_usermeta table. You can click then on each table and delete the rows containing “wpseo.”


Yoast tables

Below is the wp_options table. Make sure to filter the rows first by “wpseo” as there are other WordPress specific rows that might contain “wpseo” in the option_value, such as the WordPress cron job row. This is very important and should not be overlooked. After filtering you can then select all of them and delete them.

wp_postmeta table Yoast SEO

And here is the wp_usermeta table. Again, it is very important that you first filter the rows by “wpseo.” Then select the remaining ones and delete them.


wp_usermeta table Yoast SEO

And if you are using the new text link counter feature, you will also have to drop two additional Yoast SEO tables; wp_yoast_seo_links and wp_yoast_seo_meta.


Drop Yoast SEO tables

And the final thing would be to clean up the CRON job if there is one that runs with the plugin. You can, of course, edit the cron job row in the wp_options table, but a simpler way to ensure you don’t modify the wrong lines is to delete the CRON job with the free WP Crontrol plugin. In the case of the Yoast SEO plugin, it uses a Cron job called “wpseo_onpage_fetch,” which can easily be deleted.


Delete wpseo_onpage_fetch cron job

Summary

If you didn’t know before, hopefully, you know a little more now about how to uninstall a WordPress plugin the proper way. A majority of the plugins out there have great documentation on how to completely remove them, or even an option in their settings. And if all else fails, try Googling how to remove them.
Recommended tutorial: How To Disable WordPress Plugins (No Access to WP-Admin)
So the next time you go to delete a plugin, decide if you need the data or not. If you don’t, then take a moment and look up the correct way to fully uninstall the plugin. This will ensure you keep your database small and disk size to a minimum. And don’t forget to also optimize your database by removing and limiting revisions.


https://premium.wpmudev.org/blog/how-to-fully-uninstall-a-wordpress-plugin/

– August 20, 2018

How to fully uninstall a WordPress plugin

Plugins can be a great boon to WordPress sites, but there are times they outlive their usefulness.

If a plugin fulfills a function you don’t need anymore, stops being updated, or appears to slow your site down, it may be time to remove it.

Normally to delete a plugin you would go to the Plugins section of the admin, deactivate it first, and then select the delete option. Then you’re done… right?

Unfortunately, not always.

Uninstalling a plugin should be a simple task, but it is not always the case. Plugins can store data in a number of places, and unfortunately, not all developers include an uninstall script which fully removes that data.

What plugins typically store data?

Plugins which ask for user input are the most likely to store data.

They include:

  • Form plugins
  • Caching plugins
  • SEO plugins
  • Security plugins

Where do plugins store data?

The wp_options database table stores information on which plugins are active, and what settings they have active.

Custom database tables are created by some plugins to store data.

Plugins may modify WordPress’ wp-config.php file. If your site runs on Apache, the .htaccess file may have rules added to it. These could include security or caching settings, for example.

Files and folders within the wp-content folder may be created by plugins too.

To identify what’s added by plugins, it helps to know what’s in a standard WordPress install.

What’s in a new install of WordPress?

Database tables

A new install of WordPress will have the following tables:

  1. wp_commentmeta
  2. wp_comments
  3. wp_links
  4. wp_options
  5. wp_postmeta
  6. wp_posts
  7. wp_termmeta
  8. wp_terms
  9. wp_term_relationships
  10. wp_term_taxonomy
  11. wp_usermeta
  12. wp_users

Tables in a single vanilla WordPress install

Tables in a single vanilla WordPress install

If you set up a multisite you’ll have those 12 tables plus a few more:

  1. wp_blogs
  2. wp_blog_versions
  3. wp_registration_log
  4. wp_signups
  5. wp_site
  6. wp_sitemeta

Your WordPress install might have a prefix other than wp_ if you chose another one on install, or have altered it through the use of a plugin. (For simplicity I’ll continue to mention wp_ as a shorthand for your database table prefix.)

For each new site you add to a multisite, there will be another ten tables starting with wp_2_ etc.

wp-content folder

The basic WordPress folder has an index.php file and two subfolders:

  • plugins
  • themes

A mature install will likely have other subfolders which may include the following:

  • languages
  • mu-plugins
  • upgrade
  • uploads

Any other folders present may have been created by a plugin.

How easy is it to fully delete plugins?

I tested this out on a single WordPress install with some existing plugins. I tried installing and deleting a number of popular plugins to see how easy it was to uninstall them completely.

All the plugins I tested stored information in wp_options.

Plugins which have uninstallers in wp-admin

Gravity Forms

What’s stored?

Gravity Forms creates 9 new database tables:

  1. wp_rg_form
  2. wp_rg_form_meta
  3. wp_rg_form_view
  4. wp_rg_incomplete_submissions
  5. wp_rg_lead
  6. wp_rg_lead_detail
  7. wp_rg_lead_detail_long
  8. wp_rg_lead_meta
  9. wp_rg_lead_notes

How should you uninstall Gravity Forms?

  1. Go to Forms > Settings > Uninstall.
  2. Click the button.
  3. Choose OK.
  4. Go to the plugin screen to fully delete the plugin.
Gravity Forms Uninstall dialog

Gravity Forms Uninstall dialog

Is everything deleted?

All 9 custom tables are deleted, but some data remains in the wp_options table.

Wordfence

What’s stored?

A whopping 23 database tables are created by this popular security plugin.

  1. wp_wfBadLeechers
  2. wp_wfBlockedCommentLog
  3. wp_wfBlockedIPLog
  4. wp_wfBlocks7
  5. wp_wfConfig
  6. wp_wfCrawlers
  7. wp_wfFileChanges
  8. wp_wfFileMods
  9. wp_wfHits
  10. wp_wfHoover
  11. wp_wfIssues
  12. wp_wfKnownFileList
  13. wp_wfLeechers
  14. wp_wfLocs
  15. wp_wfLogins
  16. wp_wfNet404s
  17. wp_wfNotifications
  18. wp_wfPendingIssues
  19. wp_wfReverseCache
  20. wp_wfScanners
  21. wp_wfSNIPCache
  22. wp_wfStatus
  23. wp_wfVulnScanners

You’ll also see a wflogs folder in wp-content.

How should you uninstall Wordfence?

An alternative to Wordfence’s manual uninstall is adding the Wordfence Assistant plugin to do the job.

To use Wordfence Assistant, deactivate and delete Wordfence as normal. Then in Wordfence Assistant’s options, choose the Delete All Wordfence Data and Tables option.

Is everything deleted?

Using Wordfence Assistant, the database and files were purged of Wordfence content.

Plugins which have uninstall scripts

Well developed plugins have an uninstall.php file to take care of the uninstall process.

For example:

Broken Link Checker’s uninstall script removes its 4 database tables.

Relevanssi’s uninstall script removes 3 tables created by the plugin.

WP Rocket has an uninstall script which is supposed to remove all data and files including the advanced-cache.php file.  When I tried it, I noticed that this file stayed put after the plugin was gone.

Other plugin uninstall methods

If there is no uninstall script, some plugins have provided other suggestions for a complete uninstall.

This plugin creates 3 database tables:

  • wp_ngg_album
  • wp_ngg_gallery
  • wp_ngg_pictures

It also creates an ngg folder within wp-content.

You will need to manually remove the 3 tables and the folder, as they aren’t removed on uninstall. Try this advice for a full NextGen Gallery uninstall.

WooCommerce

WooCommerce creates 16 tables:

  1. wp_wc_download_log
  2. wp_wc_webhooks
  3. wp_woocommerce_api_keys
  4. wp_woocommerce_attribute_taxonomies
  5. wp_woocommerce_downloadable_product_permissions
  6. wp_woocommerce_log
  7. wp_woocommerce_order_itemmeta
  8. wp_woocommerce_order_items
  9. wp_woocommerce_payment_tokenmeta
  10. wp_woocommerce_payment_tokens
  11. wp_woocommerce_sessions
  12. wp_woocommerce_shipping_zones
  13. wp_woocommerce_shipping_zone_locations
  14. wp_woocommerce_shipping_zone_methods
  15. wp_woocommerce_tax_rates
  16. wp_woocommerce_tax_rate_locations

WooCommerce recommend adding a line to wp-config.php for a completed uninstall:

// Remove all data from WooCommerce on uninstall
define( ‘WC_REMOVE_ALL_DATA’, true);

view raw
wc_remove.php
hosted with ❤ by GitHub

I tried this twice and didn’t get a perfect uninstall either time. Remember to double-check that the data has gone.

Plugins which leave data behind

These are some plugins I found which don’t remove all data when uninstalled.

Akismet

Akismet stores a lot of data in the wp_commentmeta table, which remains on deletion.

Mine had nearly 6,000 rows!

EWWW Image Optimizer

This plugin stores data about the path to your images, their original size, size after compression and % reduction in the table wp_ewwwio_images. This table stayed when I removed the plugin, as did an ewww folder.

WP All Export

4 tables are created by this plugin:

  • wp_pmxe_exports
  • wp_pmxe_google_cats
  • wp_pmxe_posts
  • wp_pmxe_templates

These are not removed when the plugin is deleted.

Yoast SEO

Yoast SEO creates 2 tables:

  • wp_yoast_seo_links
  • wp_yoast_seo_meta

It also stores some data in:

wp_usermeta – contains some meta_key values like wpseo_title.
wp_postmeta – contains some meta_key values for various post ids, including:

  1. _yoast_wpseo_linkdex
  2. _yoast_wpseo_title
  3. _yoast_wpseo_metadesc
  4. _yoast_wpseo_focuskw
  5. _yoast_wpseo_focuskw_text_input
  6. _yoast_wpseo_primary_category
  7. _yoast_wpseo_content_score

A deactivate/delete uninstall leaves all this data behind.

How do you clean up after messy plugins?

Firstly, back up your site (files and database) in case you make a mistake. Super important!

WPMU Dev members can use Snapshot Pro for backups.

You’ll be using FTP and SQL queries for the clean up. If you’re not comfortable with these, have an expert on hand.

Delete pages

For any plugin that created pages, delete them if they weren’t removed on uninstall and you don’t need them any more. Remember to 301 redirect the page permalinks.

Remove unwanted database tables

Any tables which are not part of the usual WordPress install are likely to be tables added by plugins.
You can use phpMyAdmin, a database manipulation tool available on most hosting control panels.

Use the Drop option to delete individual tables from unwanted plugins.

phpMyAdmin showing tables with options including Drop
phpMyAdmin showing tables with options including Drop

phpMyAdmin’s warning confirmation dialog for dropping a table

Or select multiple tables and select Drop from the With selected dropdown, then confirm.

Dropping multiple tables with phpMyAdmin
Dropping multiple tables with phpMyAdmin

Another option is to use the Advanced Database Cleaner plugin to inspect your tables within WordPress.

There’s a button to detect orphaned tables, though you need to upgrade to the Pro version to use it.

Any plugin-related tables that you’re sure you don’t need you can delete. Check them and choose Delete from the Bulk Actions dropdown.

>Advanced Database Cleaner shows all your WordPress data tables
Advanced Database Cleaner shows all your WordPress data tables

Delete redundant folders from wp-content

FTP into your site and check the contents of files and folders you don’t recognise. If you’re sure you won’t need them, delete them.

For example:

  • EWWW Image optimizer adds an ewww folder.
  • NextGEN Gallery adds two folders – gallery and ngg.
  • WP Rocket adds advanced-cache.php and a cache folder.

The EWWW folder within wp-content
The EWWW folder within wp-content

Check wp-config.php and .htaccess files

These are critical files, so copy them first before editing them!

If you spot any lines in wp-config.php added by plugins you’ve deleted, remove them.

In .htaccess look for a # followed by the plugin name and remove any lines in between.

>Part of the code created by iThemes Security in .htaccess
Part of the code created by iThemes Security in .htaccess

Remember to upload the updated file(s) when you are done.

Cleaning up transients and cron jobs

Transients are data stored temporarily by WordPress. Checks for WordPress updates and notices on the admin dashboard are stored in transients. Transients are (mostly) set to expire after a set time period, and are recreated over time.

Some plugins create transients. The Transients Manager plugin will help you identify which plugins have done so, and you can delete any you no longer wish to keep.

Transients Manager shows transients and expiry date
Transients Manager shows transients and expiry date
>

Deleting all transients won’t remove them all – the WordPress ones remain.

Cron jobs are scheduled tasks that can be run on a web server. WordPress runs its own cron jobs through WP-Cron.

WP Crontrol plugin will show you what cron jobs are running and when.

>Some cron jobs revealed by WP Crontrol
Some cron jobs revealed by WP Crontrol
>

You can modify or delete the cron jobs, but some core cron jobs can’t be deleted.

Unfortunately you’re at the mercy of the plugin developer when it comes to naming cron jobs. If the name of a job is unclear, don’t delete it, as it may affect the performance of a plugin you depend on.

Cleaning up your database tables

Now it’s time to run some database queries for a final clean up.

Akismet

Did you use Akismet? This is a tidying up task you can run even if you continue to use the plugin, since Akismet generates a lot of table rows.

On the wp_commentmeta table, run the SQL query:

select * from wp_commentmeta where meta_key like %akismet_%;

Querying wp_commentmeta to find Akismet data
Querying wp_commentmeta to find Akismet data

(Remember to change wp_ in this query if you have a different table prefix.)

Then assuming the query found some rows, run the query

delete from wp_commentmeta where meta_key like %akismet_%;

Deleting Akismet data from wp_commentmeta
Deleting Akismet data from wp_commentmeta

You should now have a much lighter wp_commentmeta table.

Yoast SEO

Yoast data seems to lurk everywhere!

Try this SQL query on the wp_postmeta table:

select * from wp_postmeta where meta_key like %yoast%;

Yoast data in wp_postmeta
Yoast data in wp_postmeta

delete from wp_postmeta where meta_key like %yoast%;

558 rows of Yoast data were removed from wp_postmeta
558 rows of Yoast data were removed from wp_postmeta

For wp_usermeta try:

select * from wp_usermeta where meta_key like %yoast%;
delete from wp_usermeta where meta_key like %yoast%;

 

wp_options table

Most plugins leave some entries in the wp_options table. If you want to go the whole hog in cleaning you can remove the rows related to your deleted plugins.

Use similar queries to the previous ones to find relevant rows, and if any are found, delete them:

// Replace pluginname with the plugin you have removed
select * from wp_options where option_name like %pluginname%;
delete from wp_options where option_name like %pluginname%;

Replace the pluginname with the name or abbreviation of the plugin you’re looking for (keep the % signs). Most are straightforward but a few may need some educated guesswork. Examples are:

  • EWWW Image Optimizer: ewwwio
  • NextGEN Gallery: ngg
  • WooCommerce: wc

While you’re at it, you can do some more housekeeping by following these 10 database optimization tips and these WordPress clean up tips.

Summing up

Deleting plugins is not always as straightforward as it appears. A lot of information can be stored by plugins both in the filesystem and the database, and plugin developers vary on the thoroughness of their uninstall routines.

Most of us assume an uninstall means deleting all data, and that’s not regularly the case.

If you’re a plugin developer, you might not be able to bear the thought that someone may never use your plugin again! But most users will thank you for including an uninstall script. Please follow the Uninstall Methods section in the plugin development handbook.

As a user, select your plugins carefully. Find out from developers how you uninstall them. Test out new plugins on a staging site rather than your live site to keep your site clutter-free. And remember as a general rule, the bigger the plugin, the more data it stores.

Scroll to Top