Remove Leftover WordPress Plugin Data
Clean up orphaned database tables, options, and files after uninstalling WordPress plugins to keep your site fast and your database lean.
Uninstalling a WordPress plugin doesn’t always remove everything it created. Many plugins leave behind database tables, options rows, transients, and files that accumulate over time. A site that has been through dozens of plugins over the years can have a bloated database full of orphaned data.
Why Left-Behind Data Matters
- Slower database queries. Extra tables and rows mean MySQL has more to scan, even if WordPress never reads them.
- Larger backups. Orphaned data inflates your backup size.
- Confusing troubleshooting. Old data can conflict with new plugins or cause unexpected behavior if you reinstall something.
How to Find Orphaned Data
Check for Extra Database Tables
- Open phpMyAdmin in cPanel
- Select your WordPress database
- Look for tables that don’t start with your WordPress prefix (
wp_by default) - Common leftovers include:
wp_actionscheduler_*(WooCommerce/Action Scheduler)wp_yoast_*(Yoast SEO)wp_redirection_*(Redirection plugin)wp_wfhits,wp_wflogins(Wordfence)wp_statisticvisitors(WP Statistics)
If you recognize a table prefix as belonging to a plugin you no longer use, it’s safe to remove.
Check wp_options for Orphans
The wp_options table is where most plugins store their settings. After uninstalling a plugin, its options rows usually stay behind.
In phpMyAdmin, run:
SELECT option_name, LENGTH(option_value) as size_bytes
FROM wp_options
WHERE autoload = 'yes'
ORDER BY size_bytes DESC
LIMIT 50;
This shows the largest autoloaded options. Look for entries that belong to plugins you’ve already removed.
How to Clean Up
Option 1: Use a Cleanup Plugin (Easiest)
Install one of these temporarily to run a cleanup, then remove it:
- WP-Optimize – cleans database, removes transients, optimizes tables
- Advanced Database Cleaner – finds orphaned tables and options from deleted plugins
Option 2: Manual Database Cleanup
If you know exactly what to remove:
-- Delete orphaned options (example: old Yoast data)
DELETE FROM wp_options WHERE option_name LIKE 'wpseo_%';
-- Drop orphaned tables (example: old Wordfence tables)
DROP TABLE IF EXISTS wp_wfhits, wp_wflogins, wp_wfblocks7;
-- Clean up transients (safe to delete -- they regenerate automatically)
DELETE FROM wp_options WHERE option_name LIKE '_transient_%';
DELETE FROM wp_options WHERE option_name LIKE '_site_transient_%';
Always back up your database before running DELETE or DROP queries. Download a copy from phpMyAdmin or use cPanel’s backup tool.
Option 3: Clean File Leftovers
Some plugins leave files behind in:
wp-content/(custom folders, cache directories)wp-content/uploads/(generated files, logs)- The WordPress root (
/) (some security plugins drop files here)
Check via File Manager or SSH:
ls -la ~/public_html/wp-content/
Look for folders that match plugins you’ve already deleted.
Optimize Tables After Cleanup
After deleting rows, optimize the tables to reclaim disk space:
-- Optimize the options table
OPTIMIZE TABLE wp_options;
-- Optimize all tables at once (phpMyAdmin: select all tables > "Optimize table")
Or use WP-CLI:
wp db optimize
Prevention
- Before installing a plugin, check if it has a clean uninstall option (usually in the plugin’s settings page)
- Use the “Delete” button in the WordPress plugin page instead of just deactivating. Deleting triggers the plugin’s
uninstall.phpscript, which should remove its data - Keep a list of plugins you’ve tried and removed so you know what to look for during periodic cleanups
Related Articles
Last updated 19 Apr 2026, 23:46 +0300.