One of WordPress’s greatest strengths is its extensive plugin ecosystem. Plugins allow you to add new features and functionality without modifying the core system.
During the development and maintenance of a website, it is common to install, test, and remove various plugins. While most plugins clean up after themselves when uninstalled, some leave configuration settings, cached data, or other records behind in the database.
Over time, these unnecessary entries can accumulate and increase the size of the database, potentially affecting performance and making backups larger than necessary.
This guide explains how to identify database entries that may have been left behind by plugins that are no longer in use.
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 have selected the correct database.
- Review all results carefully before deleting any data.
- Confirm that your website functions correctly after performing any cleanup operations.
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');
By default, the file is 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 located at the top of the page.
This will open the SQL query editor.
Search for Plugin-Related Entries
Before removing any data, identify records that belong to the plugin.
Run the following query:
SELECT *
FROM `wp_options`
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%plugin-name%'
Replace:
plugin-name
with a keyword related to the plugin you previously removed.
Example
If you want to search for settings left behind by the Disqus plugin, use:
SELECT *
FROM `wp_options`
WHERE `autoload` = 'yes'
AND `option_name` LIKE '%disqus%'
Click:
Execute
to run the query.
Review the Results
The query will display records stored in the wp_options table that match the specified keyword.
Before deleting anything:
- Verify that the records belong to the removed plugin.
- Confirm that the plugin is no longer installed.
- Ensure that no active plugin uses the same settings.
Carefully reviewing the results helps prevent accidental removal of data required by your website.
Removing Unused Plugin Data
After confirming that the records belong to a deleted plugin and are no longer needed, you can remove them using a DELETE query.
Example:
DELETE
FROM `wp_options`
WHERE `option_name` LIKE '%disqus%'
Warning
Always review the results returned by the SELECT query before executing any DELETE statements.
Benefits of Removing Leftover Plugin Data
Cleaning up obsolete plugin records can provide several benefits:
- Reduced database size.
- Faster database backups.
- Improved database performance.
- Reduced autoloaded data.
- Better overall WordPress efficiency.
The benefits are especially noticeable on websites that:
- Have been running for several years.
- Frequently install and remove plugins.
- Have undergone multiple redesigns or migrations.
- Use a large number of extensions.
Alternative Cleanup Methods
If you prefer not to work directly with SQL queries, several WordPress optimization plugins can help identify and remove orphaned plugin data, including:
- WP-Optimize
- Advanced Database Cleaner
- LiteSpeed Cache
- WP Rocket
Always review suggested changes before confirming any cleanup operation.
Summary
Some WordPress plugins leave configuration data behind even after being removed. Over time, these unused records can contribute to database bloat and reduced performance.
To identify leftover plugin data:
- 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 a keyword associated with the plugin you want to investigate.
Before deleting any records, always create a database backup and verify that the entries are no longer required by your website.