Skip to content
wtyczki.pl

Plugins

How to Delete a WordPress Plugin and Clean Up Everything It Leaves Behind

Deleting a plugin from the WordPress dashboard takes 10 seconds. The catch is that it's only a partial removal — the files disappear, but the database keeps the tables, options, metadata and transients the plugin patiently stored for months or years. A single popular SEO plugin can leave behind hundreds of options in the wp_options table plus its own tables holding megabytes of data. If you've switched plugins a few times over the years, your database may be full of dead weight that slows down every SQL query. This article shows you how to delete a plugin properly.

wtyczki.pl editorial team 10 min read

How to Delete a WordPress Plugin and Clean Up Everything It Leaves Behind

This article is part of the guide WordPress Plugins — The Complete Guide.


What's left behind after you delete a plugin?

WordPress is designed so plugins can uninstall "cleanly" — developers can use the register_uninstall_hook() hook, which runs cleanup code when the plugin is deleted. The problem: not every developer implements it. Older plugins, free hobby projects and poorly written premium code simply leave a mess behind.

In the database

  • Custom tables — e.g., wp_rank_math_stats, wp_wpmaillog. They stay even after the plugin is deleted.
  • Rows in wp_options — settings, license keys, cached options. A single plugin can have hundreds of entries here.
  • Rows in wp_postmeta — metadata attached to posts, pages and WooCommerce products.
  • Transients — temporary cached data with the _transient_ prefix in the wp_options table.
  • User meta — data attached to user accounts, e.g., dashboard settings.

On the server (files)

  • Files in uploads — PDFs, CSVs and exports generated by the plugin that aren't removed on uninstall.
  • Cache files — static files in the plugin's dedicated cache folders.
  • Logs — event log files generated by security and backup plugins.
  • Changes to .htaccess — cache and security plugins modify server rules and don't always revert them when they're deleted.

The scale of the problem: On a WordPress site that has switched plugins several times over a few years, the database can be two or three times larger than it should be. That means slower SQL queries and bigger backup files. Regularly cleaning up after deleted plugins is one of the easiest ways to improve performance without changing your hosting or your code.


Step 1: Back up before deleting anything

Before you delete anything, back up your database and files. This is especially important before manual SQL cleanup, where one wrong move deletes data for good.

Quick backup: UpdraftPlus → Backup Now → select the database and files → run it. Make sure the backup goes to an external service (Google Drive, Dropbox) — not just to the same server.


Step 2: Deactivate the plugin

Always deactivate before deleting. On deactivation, WordPress runs the deactivation_hook, which in well-written plugins removes scheduled cron jobs and does some initial cleanup. Deleting without deactivating skips this step.

  1. Go to Plugins → Installed Plugins
  2. Click Deactivate next to the plugin
  3. Check that the site works properly after deactivation — if something broke, other elements depended on this plugin
  4. If everything looks good, move on to deleting it

Step 3: Delete the plugin

From the WordPress dashboard (the standard way)

After deactivation, a Delete link appears under the plugin name. Click it → confirm. WordPress removes the plugin folder from /wp-content/plugins/.

If the "Delete" link doesn't appear:

  • The plugin is still active — deactivate it first
  • The folder permissions are wrong — delete it via FTP
  • The plugin lives in /wp-content/mu-plugins/ (Must-Use) — it can only be removed via FTP

Via FTP

Connect with FileZilla (SFTP), go to /wp-content/plugins/, find the plugin folder and delete it.

Via WP-CLI

# Deactivate and delete with a single command
wp plugin deactivate nazwa-wtyczki && wp plugin delete nazwa-wtyczki

# Delete several plugins at once
wp plugin delete wtyczka-1 wtyczka-2 wtyczka-3

Step 4: Clean up leftovers in the database

This is where the real cleanup happens. You have two approaches: automatic, with a plugin (safer, less technical knowledge required), or manual, via phpMyAdmin (full control, requires care).

Method A: WP-Optimize (recommended for most people)

WP-Optimize (free, WordPress.org) cleans up the following with one click: orphaned post meta, orphaned user meta, expired transients, post revisions over the limit, and spam and trashed comments. How to use it: WP-Optimize → Database → select the options → Optimize.

Advanced Database Cleaner is a more advanced alternative — it lists tables and options grouped by the plugin that created them. You can see it plainly: "the wp_xyz_logs table belongs to the deleted XYZ plugin," and you can remove it selectively. The ideal tool for an audit after a thorough cleanup of your plugin setup.

Method B: Manually via phpMyAdmin (advanced users)

phpMyAdmin is available in your hosting control panel: cPanel → phpMyAdmin or Plesk → Databases.

Find and drop the plugin's tables

-- List all tables — look for tables whose names match the deleted plugin
SHOW TABLES;

-- Drop a specific table (replace with the actual name)
DROP TABLE IF EXISTS wp_nazwa_wtyczki_logi;

Clean up options in wp_options

-- Find options left behind by the plugin
SELECT option_name FROM wp_options WHERE option_name LIKE '%prefiks_wtyczki%';

-- Delete the options you found
DELETE FROM wp_options WHERE option_name LIKE '%prefiks_wtyczki%';

-- Clean up expired transients
DELETE FROM wp_options WHERE option_name LIKE '_transient_%'
AND option_name NOT LIKE '_transient_timeout_%';

Clean up orphaned post meta

-- Delete post metadata whose posts no longer exist
DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts p ON pm.post_id = p.ID
WHERE p.ID IS NULL;

The rule for manual SQL: Always run a SELECT with the same conditions as the planned DELETE first and review the results. DELETE queries can't be undone — don't delete anything if you don't understand what it does.


Step 5: Clean up files outside the plugin folder

The /wp-content/uploads/ folder

Some plugins create subfolders in uploads — backups, CSV exports, PDF files. After deleting the plugin, check via FTP whether any folders with names similar to the deleted plugin are left in uploads. Delete them if you no longer need the data.

The .htaccess file

Cache and security plugins modify .htaccess and often don't restore it. Open the file via FTP or your file manager and check for blocks marked # BEGIN NazwaWtyczki ... # END NazwaWtyczki. Remove these blocks manually if the plugin didn't clean them up.

The /wp-content/cache/ folder

Cache plugins create subfolders in this directory. After deleting a cache plugin, check whether any files are left in /wp-content/cache/ and delete them.


Step 6: Verify everything after the cleanup

  • Visit the homepage and a few other pages — do they display correctly?
  • WordPress dashboard — no error messages or missing elements?
  • Pages that used the deleted plugin's shortcodes — are they showing a raw shortcode instead of content?
  • Query Monitor — have the number of SQL queries and PHP memory usage gone down?
  • GTmetrix — has the load time improved?

Special cases — trickier removal scenarios

Removing a page builder (Elementor, Divi, Beaver Builder)

One of the toughest cases. Page builders store layout data as post metadata or in their own tables. Once you remove a page builder, the pages built with it lose their design and show raw, unstyled HTML. Before removing a page builder, you have to rebuild every page in a different system — there's no tool that automatically migrates between builders. Plan this change as a project, not a one-off task.

Removing an SEO plugin

Before removing Yoast SEO, Rank Math or another SEO plugin, make sure you export or migrate your data: meta titles, meta descriptions, Open Graph, redirects. If you're switching SEO plugins, use the importer built into the new one (Rank Math imports data from Yoast SEO, All in One SEO and others). Don't delete the old SEO plugin until you've confirmed the import worked.

Removing WooCommerce or its extensions

When you deactivate WooCommerce, it asks whether to delete the store data. If you plan to reinstall, choose "no." If you're closing the store, keep in mind that order and transaction data are subject to retention requirements under tax law (in Poland: 5 years).

Membership and online course plugins (MemberPress, LearnDash, LifterLMS) store subscription data, student progress and transactions. Before deleting them, export your user data and check your legal obligations under your agreements with customers.


How to find a plugin's shortcodes across all your pages

Once a plugin is deleted, its shortcodes turn into visible text on the page. Before deleting it, find every place they're used. Two methods:

SQL via phpMyAdmin

SELECT ID, post_title, post_type
FROM wp_posts
WHERE post_content LIKE '%[nazwa-shortcode%'
AND post_status = 'publish'
ORDER BY post_type, post_title;

The Search Regex plugin (no SQL needed)

Search Regex (free, WordPress.org) searches the content of all posts, pages and CPTs from the WordPress dashboard. Enter the shortcode in the search field — you'll get a list of every place it's used, with edit links.


Best practices for keeping your plugins tidy

  • Audit every quarter — go through your plugin list and ask: which ones do I actively use? What can I remove?
  • Delete right away — don't deactivate "for later" — a deactivated plugin with no plan to reactivate it is dead weight and a potential security risk
  • Optimize your database once a month — WP-Optimize on a schedule automatically removes transients, revisions and spam
  • Test new plugins on staging — if a plugin doesn't live up to expectations, you remove it without leaving a trace in the production database
  • Check .htaccess after deleting cache and security plugins — leftover rules can cause 500 errors or incorrect redirects

FAQ — deleting WordPress plugins

Does a deactivated plugin slow down WordPress?

A deactivated plugin doesn't load PHP code, so it doesn't affect front-end performance. But its files take up space on the server, and its data stays in the database. If you don't plan to reactivate it, delete it — don't just deactivate it.

How can I check how much data old plugins have left in the database?

Install Advanced Database Cleaner — after a scan, it shows a table listing orphaned data and tables attributed to inactive or deleted plugins. It's the fastest way to gauge the scale of the problem without combing through phpMyAdmin by hand.

Can I remove WooCommerce without losing my order history?

Yes — when you deactivate WooCommerce, it asks whether to delete the data. Choose "no." Order, product and customer data stay in the database. If you reinstall WooCommerce, the data will be available again. Without the plugin active, however, you can't access it from the dashboard.

I deleted a plugin, but its menu still shows up in the dashboard. What should I do?

Clear your browser cache (Ctrl+F5) and refresh the page. If the menu is still there, clear transients with WP-Optimize. That usually fixes "ghost" menus.

How often should I clean the database after deleting plugins?

Automatic cleanup of transients and revisions — once a month with WP-Optimize. A full audit that removes orphaned data and unneeded tables — once a quarter, or after every major cleanup of your plugin setup.


All cleaned up. Now see which plugins are worth installing instead — the best free WordPress plugins or when a premium plugin is worth it.

← WordPress Plugins — The Complete Guide

Looking for solid replacements for the plugins you deleted? In our store, you'll find premium plugins with support in English and Polish, a VAT invoice and a guaranteed clean uninstall — no junk left in your database.

Browse premium plugins on Wtyczki.pl →

Keep reading

More posts

WordPress Multisite Plugins: Managing a Network of Sites Plugins

WordPress Multisite Plugins: Managing a Network of Sites

WordPress Multisite lets you run many sites from a single WordPress installation: one shared codebase and plugin library, but separate database tables for content, separate users and separate settings for each site in the network. It's a powerful tool for agencies managing dozens of client sites, blog networks, education portals and companies with an extensive subdomain structure. But Multisite fundamentally changes how plugins work — and that's exactly what this article is about.

12 min read

How to Create a WordPress Plugin: The Basics for Beginners Plugins

How to Create a WordPress Plugin: The Basics for Beginners

Building your own WordPress plugin opens up a whole new world: you stop depending on whatever is available on the market and can build exactly what you need. It doesn't take years of experience, either — a basic, working plugin is just a dozen or so lines of PHP. This article walks you through the fundamentals, from file structure to hooks, shortcodes and a settings page, with code examples you can run on your own site today.

18 min read

WordPress Social Media Plugins: Share Buttons, Feeds and Sharing Plugins

WordPress Social Media Plugins: Share Buttons, Feeds and Sharing

Social media and WordPress should work together smoothly, but they often cause needless trouble: slow pages from external SDKs, share buttons that miscount, and Instagram feeds that break after yet another Meta API change. In this article, we walk through every type of social media integration for WordPress and pick tools that get the job done without weighing your site down.

11 min read