Options, Sitemeta and Metadata Management
Management for WordPress Options, Sitemeta and Metadata tables is more or less part of the same feature in SweepPress plugin, because it has centralized methods for detection of the option or metadata source and uses similar presentation for the data.
Metadata and Sitemeta management features are not available in the Lite version of the plugin!
Options Management feature is available in both Pro and Lite versions of the plugin.
Major issue with storing data in any WordPress table (and especially tables for options and metadata), is that there is no specifications in WordPress on how these tables can be used, how the data is stored and removed, and most plugins don’t have proper uninstallation process to remove records no longer in use.
To know which records you can delete, you need to manually go through the records and either recognize the record by name associated with specific plugin, and have a lot of experience with WordPress to be sure what can be safely deleted.
SweepPress plugin has sweepers that can remove transient record because they are safe to remove, and if missing, the WordPress or plugins will regenerate them when needed. And, SweepPress has few sweepers that deal with orphaned metadata and other records that can be deleted with full confidence, but most of the data in these tables can’t be auto deleted, and require you to make the decision based on the information SweepPress can present about all these options and meta records.
Source Detection
SweepPress has several methods to determine which plugin, theme or component is using or updating records in any of these tables.
- WordPress options and meta keys: is list of all options and meta keys that are used in WordPress core. This information is updated with every new WordPress version to include any new options and meta keys that WordPress introduces. These lists are very important to other detection methods to be used in a process of elimination.
- Build in database: with regular expressions and record names for all Dev4Press plugins, and a lot of popular WordPress plugins. This database will be expanded in future plugin versions with more plugins and themes.
- Files scanner: which scans all plugins and themes with regular expressions to find all the options names that plugins or themes use. This method is very reliable for huge number of plugins that directly access the options or metadata, but it doesn’t cover every plugin, because some plugin may have prefixed settings that use variables for names, and SweepPress can’t determine the options names.
- Usage monitoring: which monitors some WordPress filters and actions to find which plugins and themes are loading or updating which options or metadata. This is the most reliable method, but it adds some performance overhead to the page loading. To learn more about this method, check out this article.
- Registered data: plugin also allows other plugins to hook into, and register own options and metadata. This can be useful for some edge cases where there is no clear way to detect what metadata or options get used. Dev4Press own GD Content Tools Pro plugin (since version 6.3) has support for this feature for all meta boxes registered with that plugin. This method is available only in Pro version of the plugin!
Using these methods provides around of 95% reliable detection based on testing done on 15 websites. All these methods will be improved over time, and any information to improve detection is welcomed.
Multisite Detection
SweepPress fully supports WordPress Multisite installations. It can be activated as network wide (and all blogs on the network will have it active), or you can activate it for some blogs only. When it comes to detection process, to avoid doing same work on each blog, all detection data is stored in the WordPress Sitemeta database tables, so anything detected on one blog is instantly available for all other blogs in the network, so the scan and detection data is shared, making it faster to clean up up multiple blogs, because the data gathered in previous blogs can be used.
Important to know
- There is no guarantee that all sources are identified and there is no guarantee that the information presented on the
Options,SitemetaandMetadatapanels is completely correct! - Some detection methods depend on plugins and themes being installed in the directory that plugin or theme authors initially released for. If you change the directory names for plugins or themes, SweepPress might not be able to use all detection methods properly.
- File scanner and process monitor methods need time to complete scan or monitoring. Scanner method is scheduled to do regular updates in case plugins or themes change.
Terminology
Transient Records
Transient records are temporary records that usually have expiration. If the transient record expiration is reached, transient record is no longer valid and can be removed. Transients are mostly used to cache data, with size limit of 4GB per record. Both Options and Sitemeta tables support storing of transient records and WordPress has several functions dedicated to storing, retrieving and deleting transient records.
Meta ID and Meta Key
Every metadata table has Meta ID to identify each metadata record with the unique identification. Meta ID is auto generated by the database and it is a unique ID for the table.
Meta Key is a string name of the metadata which can be used more than once in the metatable to identify the same record type across different content element.
Options Database Table
WordPress database table Options (usually named wp_options with default database prefix) is used to store all the WordPress core settings, handle settings for plugins and themes, handle settings for widgets, and store transient cache data. And, to optimize the loading speed, some of the records in this table are marked as autoload records, and will be loaded via one query when the WordPress starts the page request processing.
Options Management
SweepPress (both Lite and Pro versions) adds the Options panel where you can manage data in the Options table. This panel doesn’t show default WordPress records, and it doesn’t show transient records. It is a very, very bad idea to delete any of the records added by the WordPress core, because WordPress always assumes that these settings exist, and if they do not, it can cause all sorts of issues, including website not loading at all. Modifying WordPress core settings directly is not advised, you should use WordPress Settings panel to do that safely.
To confirm: SweepPress Options panel lists all the records from
wp_optionstable except for the records added by WordPress Core and Transient records. This will ensure that you will not remove any of the WordPress settings by mistake. If you want to delete transients, SweepPress already has sweepers for that purpose.
Now, the most important part in the Options Management is to know the source for each records in the Options database table. Experienced users may be able to recognize the options, but for most website owners that will be out of reach.
Options Status Determination
Once the plugin can identify which option belongs to which plugin or theme, it will also determine if the plugin or theme is active, and based on all that, it will show Delete options only for options that are not identified (Unknown), or belong to plugins or themes that are no longer installed or not active.
Filtering and Searching
The article about Options Panel has more information about the displayed data and actions you can do for Options records.
Sitemeta Database Table
WordPress Sitemeta database table is part of the WordPress Multisite installation, and it is used to store network wide settings. WordPress uses this table for own network wide settings, and all plugins can do that also. Settings stored in this table, are available in any website in the network. Like the Options table, Sitemeta supports use of Network wide transient records.
Sitemeta options Management
SweepPress Pro adds the Sitemeta panel where you can manage data in the Sitemeta table. This panel will be visible only if you run WordPress Multisite, and only on the main blog in the multisite network. This panel doesn’t show default WordPress records, and it doesn’t show transient records.
To confirm: SweepPress Sitemeta panel lists all the records from
wp_sitemetatable except for the records added by WordPress Core and Transient records. This will ensure that you will not remove any of the WordPress settings by mistake.
Metadata Management
WordPress has 5 metadata tables in the database, and each metadata table is linked to a corresponding content table. And, plugin also supports management for the Logmeta and Logs tables added by the coreActivity plugin.
- postmeta: contains metadata for
posts. - commentmeta: contains metadata for
comments. - termmeta: contains metadata for
terms. - usermeta: contains metadata for
users. - blogmeta: contains metadata for
blogs. Only available in the Multisite installations. - logmeta: contains metadata for
logs. Only when the coreActivity plugin is active.
Each meta table follows the same structure, having meta ID, meta key and meta value, and the ID for the main table reference. That ID links postmeta records to posts, or usermeta records to users.
Metadata are used to store additional information about posts, terms, users, comments or blogs. But, meta records can be essential, and the objects records belong to can be broken if the records are missing. Be careful deleting any metadata from the database!
Metadata Tables Management
SweepPress Pro edition adds the Metadata panel where you can manage data in all supported and available metadata tables. Unlike Options and Sitemeta panel, these new metadata panels will show default WordPress records. But, all records that are recognized as WordPress sourced will not have option to delete them.
If you want to use delete option for WordPress meta keys, you can enable that option in the plugin settings.
Deleting of Options and Metadata Records
Very Important
- Deleting records is final. Once the record is deleted from the database table, SweepPress has no way to restore the record. Make sure you have regular backups of your database, in case you need to restore data later on. Keeping regular backups is essential maintenance operation for any website!
- Be careful with usermeta table. Various meta records in usermeta table belong to WordPress. But, some of those records are important to control the users access to the website. Deleting these records is not advisable, unless you understand the consequences of doing that.
- WordPress meta records should not be removed. Deleting meta records belonging to WordPress is not as damaging to website as removal of options can be, so SweepPress has option to allow you to delete all meta records. But, depending on the table, meta records are very important.