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.
In this post, we’ll cover:
What plugins typically store data?
Where do plugins store data?
What’s in a new install of WordPress?
How easy is it to fully delete plugins?
Plugins that have uninstallers in wp-admin
Plugins that have uninstall scripts
Other plugin uninstall methods
Plugins that leave data behind
How do you clean up after messy plugins?
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:
wp_commentmeta
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_termmeta
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_users
If you set up a multisite you’ll have those 12 tables plus a few more:
wp_blogs
wp_blog_versions
wp_registration_log
wp_signups
wp_site
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 that have uninstallers in wp-admin
Gravity Forms
What’s stored?
Gravity Forms creates 9 new database tables:
wp_rg_form
wp_rg_form_meta
wp_rg_form_view
wp_rg_incomplete_submissions
wp_rg_lead
wp_rg_lead_detail
wp_rg_lead_detail_long
wp_rg_lead_meta
wp_rg_lead_notes
How should you uninstall Gravity Forms?
Go to Forms > Settings > Uninstall.
Click the button.
Choose OK.
Go to the plugin screen to fully delete the plugin.
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.
wp_wfBadLeechers
wp_wfBlockedCommentLog
wp_wfBlockedIPLog
wp_wfBlocks7
wp_wfConfig
wp_wfCrawlers
wp_wfFileChanges
wp_wfFileMods
wp_wfHits
wp_wfHoover
wp_wfIssues
wp_wfKnownFileList
wp_wfLeechers
wp_wfLocs
wp_wfLogins
wp_wfNet404s
wp_wfNotifications
wp_wfPendingIssues
wp_wfReverseCache
wp_wfScanners
wp_wfSNIPCache
wp_wfStatus
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 that 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.
NextGEN Gallery
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:
wp_wc_download_log
wp_wc_webhooks
wp_woocommerce_api_keys
wp_woocommerce_attribute_taxonomies
wp_woocommerce_downloadable_product_permissions
wp_woocommerce_log
wp_woocommerce_order_itemmeta
wp_woocommerce_order_items
wp_woocommerce_payment_tokenmeta
wp_woocommerce_payment_tokens
wp_woocommerce_sessions
wp_woocommerce_shipping_zones
wp_woocommerce_shipping_zone_locations
wp_woocommerce_shipping_zone_methods
wp_woocommerce_tax_rates
wp_woocommerce_tax_rate_locations
WooCommerce recommend adding a line to wp-config.php for a completed uninstall:
I tried this twice and didn’t get a perfect uninstall either time. Remember to double-check that the data has gone.
Plugins that 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:
_yoast_wpseo_linkdex
_yoast_wpseo_title
_yoast_wpseo_metadesc
_yoast_wpseo_focuskw
_yoast_wpseo_focuskw_text_input
_yoast_wpseo_primary_category
_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.
Or select multiple tables and select Drop from the With selected dropdown, then confirm.
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.
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.
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.
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.
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.
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:
(Remember to change wp_ in this query if you have a different table prefix.)
Then assuming the query found some rows, run the query
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:
For wp_usermeta try:
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 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.