WordPress Optimization – Removing Leftover Data from Deleted Plugins

On this page
  1. Access phpMyAdmin
  2. Log In to the Database
  3. Open the SQL Query Editor
  4. Search for Plugin-Related Records
  5. Example
  6. Review the Results Carefully
  7. Removing the Records
  8. Why Remove Old Plugin Data?
  9. Alternative Cleanup Methods
  10. Summary

One of WordPress’s greatest strengths is its extensive plugin ecosystem. Plugins allow you to add new features and functionality without writing custom code.

However, not every plugin is kept permanently. During website development, it is common to install, test, and remove various plugins. Some plugins leave configuration data behind in the database even after they have been uninstalled.

Over time, these unused records can accumulate and increase the size of your database unnecessarily.

This guide explains how to identify database entries that may have been left behind by a removed plugin.

Important

This guide is intended for users with basic database administration knowledge.

Before executing any SQL queries:

  • Create a complete database backup.
  • Verify that you are working with the correct database.
  • Review the query results carefully before deleting any data.
  • Confirm that your website functions correctly after making changes.

Access phpMyAdmin

  1. Log in to the mybox Panel.
  2. Navigate to:
Databases
  1. Click:
phpMyAdmin

A new browser tab will open with the database login page.

Log In to the Database

Use the database credentials associated with your WordPress website.

If you do not know the credentials, you can find them in the wp-config.php file located in the root directory of your WordPress installation.

Example:

define('DB_NAME', 'database_name');
define('DB_USER', 'database_user');
define('DB_PASSWORD', 'database_password');
define('DB_HOST', 'database_host');

The file is typically located in:

public_html

Open the SQL Query Editor

After logging in:

  1. Select your WordPress database from the left-hand menu.
  2. Click the:
SQL

tab at the top of the page.

This opens the SQL query editor.

Before removing anything, identify records that belong to the plugin.

Use the following query:

SELECT *
FROM `wp_options`
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%plugin-name%'

Replace:

plugin-name

with a unique identifier related to the plugin.

Example

If you are looking for data left behind by the Disqus plugin:

SELECT *
FROM `wp_options`
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%disqus%'

The query will display matching records stored in the wp_options table.

Review the Results Carefully

Before deleting any records:

  • Verify that the entries belong to the plugin you removed.
  • Ensure the plugin is no longer installed.
  • Confirm that no active plugin depends on the displayed settings.

Some plugins share common naming conventions, so deleting the wrong records could affect website functionality.

Removing the Records

After reviewing the results and confirming that the entries belong to a removed plugin, you can remove them using a DELETE query.

For example:

DELETE
FROM `wp_options`
WHERE `option_name` LIKE '%disqus%'

Warning

Execute deletion queries only after reviewing the results returned by the SELECT query and ensuring the records are no longer needed.

Why Remove Old Plugin Data?

Cleaning up leftover plugin records can provide several benefits:

  • Reduced database size.
  • Faster database backups.
  • Improved database performance.
  • Reduced autoloaded data.
  • Better overall WordPress efficiency.

This is particularly useful on websites that have:

  • Used many plugins over time.
  • Undergone multiple redesigns.
  • Been migrated between hosting providers.
  • Been operating for several years.

Alternative Cleanup Methods

If you prefer not to work directly with SQL queries, several optimization plugins can help identify and remove orphaned plugin data, including:

  • WP-Optimize
  • Advanced Database Cleaner
  • LiteSpeed Cache
  • WP Rocket

Always review suggested deletions carefully before confirming them.

Summary

Some WordPress plugins leave configuration data in the database after being removed.

To identify potential leftovers:

  1. Open phpMyAdmin.
  2. Select your WordPress database.
  3. Open the SQL tab.
  4. Run:
SELECT *
FROM `wp_options`
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%plugin-name%'

Replace plugin-name with the name of the plugin you removed.

Review the results carefully before deleting any records, and always create a database backup before performing cleanup operations.

Didn't find an answer?

Our support team is here for you 24/7 – write to us and we will help you sort it out.