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.
Table of Contents
Access phpMyAdmin
- Log in to the mybox Panel.
- Navigate to:
Databases
- 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:
- Select your WordPress database from the left-hand menu.
- Click the:
SQL
tab at the top of the page.
This opens the SQL query editor.
Search for Plugin-Related Records
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:
- Open phpMyAdmin.
- Select your WordPress database.
- Open the SQL tab.
- 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.