=== Clean Options === Contributors: Mittineague Tags: remove options, wp_options Requires at least: 2.1 Tested up to: 2.7.1 Stable tag: Trunk == License == Released under the terms of the GNU General Public License. == Version History == 1.1.2 25-Feb-2009 - added show_errors to DB objects - friendlier CSS selectors - added label tags 1.1.1 21-Feb-2009 - query syntax change - query error catching added - error scope changes 1.1.0 RC 27-Jan-2009 - limit 'delete all' rss delete to < 100 highest id - added rss_ hash limited find - fixed and updated the $known_ ok array - improved robustness - - fixed searchdir() return type initialization - - set explicit return type in $wpdb->get_results queries - - ini_ get('safe_ mode') fixes - changed found rss_ hash options section - added javascript select/deselect all - various other minor tweaks 1.0.0 RC 12-Nov-2008 - increased memory limit from 32M to 64M - added remove all rss_ hash section Beta 0.9.7 06-Aug-2008 - provided for time limit increase - updated the $known_ ok array (for WordPress 2.6) - added test for empty option_ name field [autoload != yes block] Beta 0.9.6 19-Oct-2007 - added test for empty option_ name field [autoload = yes block] - tweaked error handling Beta 0.9.5 18-Oct-2007 - scoped $cur_ wp_ ver - changed WP_ Error obj syntax - replaced get_ alloptions() with get_ all_ yes_ autoload_ options() - updated the $known_ ok array - removed $wpdb->hide_ errors() from get_ all_ no_ autoload_ options() - removed global $wp_ queries from get_ all_ no_ autoload_ options() Beta 0.9.4 06-Oct-2007 - added WordPress ver. 2.3 compatibility Beta 0.9.3 06-Jul-2007 - updated/improved WP core options array - provided for memory limit increase - optimized memory usage Beta 0.9.2 25-Apr-2007 - improved protection against accidental removal of WP core options - - expanded the $known_ ok array - - test for non-default install prefix user_ roles option - - added backup suggestion Beta 0.9.1 24-Apr-2007 - changed a 'hard-coded' wp_ to $wpdb-> Beta 0.9.0 22-Apr-2007 - added get_ all "rss_ " options - changed str_ replace() to wordwrap() Beta 0.7.1 17-Apr-2007 - added "Further Information" section Beta 0.7.0 13-Apr-2007 == Description == Finds orphaned options and allows for their removal from the wp_ options table. == Long Description == The Clean Options plugin provides an easy way for WordPress bloggers to manage their wp_ options table. It has many built safety features that will help prevent accidental deletion of table rows that may be needed for the error free operation of the blog. It's goal is to give plugin users an easy and safe way to get a bloated wp_ options table down to a manageable size, thus improving the performance of their blog, and keep it that way. It also provides error messages that will alert plugin users of potential problems that are encountered. == Other Notes == = Orphaned Options List = Listed Options are those that are found in the wp_ options table but are not referenced by "get_ option" or "get_ settings" by any of the PHP files located within your blog directory. If you have deactivated plugins and/or non-used themes in your directory, the associated options will not be considered orphaned until the files are removed. Non-selectable Options are known to have been created from files present during upgrade or backup, or are legitimate options that do not "fit" the search for get_ option or get_ settings. If you wish to remove them by other means, do so at your own risk. = RSS Options = The plugin handles the rss_ hash options, added to the wp_ options table from the blog's dashboard page and other files that parse RSS feeds and cache the results, in three ways. If the wp_ options table contains more than 500 rss_ hash options, the "delete all" feature will be available. Submitting the "Delete ALL 'rss' Options" may delete **ALL** "rss_ hash" rows from the wp_ options table, including the **CURRENT** ones. It is not expected that doing so will cause any problems, however, it makes the performance of a database **BACKUP** prior to deletion even more important. To help ensure that no current "rss" options are deleted, the plugin makes the last 100 entries of the wp_ options table exempt from the "delete all". But depending on your installation history this may not be adequate protection. The "rss_ hash" rows are **not** retrieved and displayed, but simply deleted. Even with the built in safety feature, it is recommended that instead of doing this, that the number of rss_ hash options found be limited to only the 300 oldest at a time, being repeated as needed. If the wp_ options table contains more than 300 rss_ hash options, a checkbox is visible that will allow the number of rss_ hash options found to be limited to only the 300 oldest. This can be repeated until the number of rss_ hash options is less than 300. When the wp_ options table contains less than 300 options, the plugin finds **ALL** of the "RSS" Options. In each pair, the upper option is the cached feed and the lower is the option's timestamp. Those listed may include options that are **Currently Active** When shown, rss_ option pairs with dates newer or the same as the date of 14'th newest rss_ option pair (the ones that are more likely to be current) have no checkbox but begin with "-" and end with "*# days old*" in italics. The older rss_ options can be selected and end with "**# days old**" in bold. Please only remove the older options in which **BOTH** options of the pair can be selected. For convenience, a javascript select/deslect all has been added to the plugin. = Orphaned Options Preview = Spaces have been added after every 10th character of the option_ name and every 20th character of the option_ value to preserve page layout. Not all options have values and / or descriptions. Please review this information very carefully and only remove Options that you know for certain have been orphaned or deprecated. It is strongly suggested that you **BACKUP** your database before removing any options. == Installation == 1. If you are upgrading, deactivate the plugin before step 2 2. Upload 'cleanoptions.php' to the '/wp-content/plugins/' directory 3. Activate the plugin through the 'Plugins' menu in WordPress 4. Click the 'Manage' admin menu link, and select 'CleanOptions' == Frequently Asked Questions == = Does this plugin have any limitations? = The Clean Option plugin searches only PHP files in your blog's folders for get_ option('option_ name') and get_ settings('option_ name'). It does match slight variations such as get_ option - space - ( - space - " etc. but there may be instances where files use values in the wp_ options table that do not match these patterns. Nor does it find unused options. It finds orphaned options, that is, options that do not have any files that "get" their values. Some options are known to have been created by files that are temporary, such as during upgrade and back-up. This plugin finds **ALL** of the "rss_ hash" options, even those that are current. Rather than tasking the server with a script that identifies current options, this plugin indentifies options that are *likely* to be current based on their timestamp. Because of these limitations, the fact that unused options in the wp_ options table have only a negligible effect upon performance, and the unknown effects of removing needed options, only options that are known to have been orphaned or deprecated should be removed. = Will this plugin work with PHP version 4 ? = Yes. I honestly don't know why some hosts still offer PHP 4 as version 5 has been out for quite some time, but yes, this plugin works with PHP >= 4.2.0 and PHP 5. Because the Clean Options plugin uses native WordPress functions whenever possible, as long as WordPress works with PHP version 4 so will this plugin. = How can I help? = If you find any bugs with this plugin, please let me know. Many thanks to those that have reported problems with the plugin. = How about about a select all? = The Clean Options plugin now has a javascript select/deselect all feature. Please note that the plugin author strongly believes that deleting rows from the wp_ options table should be done thoughtfully and with care. However, for some blogs the table has become so bloated with excessive "rss_ hash" rows, it is obviously more than just a matter of convenience. In fact, in extreme cases, the number of rows is such that the plugin taxes the memory limits of PHP while gathering the information to display them. The plugin attempts to remedy this in several ways. A "Delete ALL 'rss' Options" has been added to the plugin (see Other Notes - RSS Options). There is also a limited "Find" checkbox (see Other Notes - RSS Options) that will find rss_ hash options in batches of 300. == Screenshots == 1. The Orphaned Options list 2. The RSS Options list 3. The pre-delete Preview table == More Info == For more information, please visit the plugin's page [Clean Options](http://www.mittineague.com/dev/co.php) For support, please visit the forum (registration required to post) [Support](http://www.mittineague.com/forums/viewtopic.php?t=101) For comments / suggestions, please visit the blog [Comments / Suggestions](http://www.mittineague.com/blog/2008/11/clean-options-plugin-release-candidate/) *********************** ** AN IMPORTANT NOTE ** *********************** You should not remove options from the wp_ options table unless you are certain they have been orphaned or deprecated.