Manage WordPress Options Table

This is the example process of how you can clean up your WordPress Options database table. It is done using SweepPress Pro 5.1, and the process was carried out on the Dev4Press website.

Preparations

For the period of 5 days, SweepPress Options and Meta Usage Monitoring was active for both Update and Reading. Read more about that in this article. In turn, that process identified more than 350 options and linked them to the plugins currently used by the website.

Manage Options panel displayed total of 797 options records found (this doesn’t include WordPress Core options or Transient records).

Options Overview

Using filters on top of the table, I have done few things to get relevant results to get records for removal.

  • 180 records were marked as ‘Unknown’. That means that none of the detection methods was able to recognize these options, and they were not used in the last 5 days (since the Usage Monitoring has not picked them up).
  • 113 were marked as ‘Missing’. That means that these records are recognized by SweepPress, but the plugin or theme they belong to are not installed on the website. These are old options for plugins you used a while ago, but removed in the meantime.
  • 20 were marked as ‘Installed’ (but not Active). These records belong to plugins and themes you have installed, but they are not active. In case of my website, Dev4Press is multisite network, and I do have plugins that are active on some blogs, and no longer on other blogs anymore, but some settings remain in the database.

So, this gives total of 385 records to remove. This is almost half of non-WordPress and non-Transient records currently in this table. This is huge number of records that would be of great benefit to have deleted from the database.

Based on all that, I decided to review all the records and remove as much as possible.

Removal Process

Best way to proceed is to split the removal into phases to be sure not to miss anything and not to remove anything important. For starters, plugin will not have removal option for any records that have ‘Active’ status. This will make sure that every recognized option that is linked to existing plugins or themes, is not affected.

To help with the process, I will be relying on the filters above the table, especially one with prefixes. And, search option is very useful too. To make things easier, I have switched the table to show 50 rows at the time (open Screen Options on top of the page for that), and I do all this on a desktop monitor, because working on the sensitive things like this, is not really suited for small tablet or phone screens.

And, pay attention to the ID column. The lower the ID of the record is, the older the record is. Currently, Dev4Press Options table has Auto Increment value for ID column close to 3.000.000, so very low ID numbers belong to very old records.

Remove ‘Unknown’ options

When I switched the Status to ‘Unknown’, I got the 180 results. Good idea at this stage, is to go through the list, and all the result pages, and note the settings with the same or similar name (or prefix). Usually, prefix is used to identify the plugin name, and if you see that marked as Unknown, you may recognize the plugin that you used in the past. Or, you maybe recognize the plugin that you use currently, but SweepPress has not recognized it, mark that down and don’t remove it.

  1. In my case here, I have noticed 47 Unknown records with prefix ‘headspace_’. This records belonged to very old SEO plugin from 10 to 12 years ago called ‘Headspace’. I have marked all these, and removed using Bulk action on top of the table. Dialog will be displayed to asks for confirmation, and you need to confirm deletion.
  2. Next, there are 32 Unknown records with prefixes ‘d4pblog and ‘dev4press_gd-‘. These belonged to old Dev4Press plugins that are now retired and not used, or replaced by other plugins. Removing all those too.
  3. More old Dev4Press plugins were listed with prefixes ‘gd-press-tools’, ‘gd-taxonomy-tools’ and few more. With this, 15 more records are removed. Total of removed records so far is 94.
  4. Now, there are 28 Unknown records with prefix ‘xs2_’. These belonged to old Dev4Press Themes, that I don’t use since 2019. They are also now removed.
  5. I have recognized records belonging to other old plugins no longer used, and removed another 37 records. So far 159 records are removed.

Now we come to some very interesting records:

  1. There are several options like ‘showvideoinfo’, ‘showmp3info’, ‘mp3_listen’…. They are all empty, and not recognized. I decided to remove them, but I have no idea what these can be.
  2. Record ‘docs_userroles’. This is the list of user roles, but with the database prefix ‘docs‘. Since my website uses different prefix, this record is something very old, and no longer belongs to the website.
  3. On the website I use ShortPixel plugin, and that plugin is correctly recognized. But, in Unknown, there are 3 records with Short Pixel in name, and I searched, these are no longer in th ShortPixel plugin, meaning that records are from some older plugin version, and can be removed.
  4. Records with names ’embed_size_h’ and ’embed_size_w’. These look like WordPress records, but I have not found them anywhere. For now, I decided to leave them be.

I deleted more records, and total of Unknown records I removed is 173, and freeing 500KB of disc space.

Remove ‘Missing’ options

Now, Missing options. These are records recognized, but plugins or themes are missing.

  1. Switching to Source ‘Theme’ and Status ‘Missing’, reveals two records prefixed ‘thememods‘ belonging to old themes no longer used. These records contain Customizer settings for themes, and both can be removed.
  2. And, there are 17 more records with prefix ‘wpil_’. These belong to Link Whisper plugin that I tested, but have not continued to use. They can be removed.
  3. Finally, there 94 records marked as ‘Widget’, prefixed with ‘widget_’, and with the status missing. These records belong to WordPress widgets (Core or third party plugins). If the widget is currently not registered by the widget code, it is missing and the settings record can be removed. All 94 are removed.

All 113 records are removed.

Removed ‘Installed but not Active’ options

Finally, recognized and installed plugins, but they are not active.

  1. One record is ‘ozh_yourls’ belonging to Yourls plugin, but it is no longer used (but I have it installed, and not active).
  2. And, 19 records belong to older Dev4Press plugins that are now replaced: GD Security Toolbox and GD SEO Toolbox. They can be removed.

Total of 20 records here are removed.

Final Results

So, total of 306 records are removed from Options table, and 535KB of space is freed. Not just that we have less records overall, and some space freed in the database, there is one more benefit.

The benefit is that most of these 306 records had ‘Autoload’ flag set, meaning they were loaded into memory on each page load. That means that WordPress is loading a huge amount of data one each page load in form of data that is not used at all.

Rate this article
0
0
36

You are not allowed to rate this post.

Leave a Comment