Clean Options Plugin

Have you tried different themes for your blog and no longer use them? Installed plugins that have since been removed? Although having unused rows in your wp_options table may have only a minimal effect on your blogs efficiency, you may still want to remove them. This plugin provides an easy way to do just that.

This post is for comments, suggestions etc. If you need support for the plugin
– please visit the Mittineague Forums (registration required to post)

If you find any bugs, please let me know.

Suggestions for improvement are welcome here too, although I can't guarantee they'll get implemented, feel free to make them.

For more information please visit the Clean Options Plugin page.

Thanks, Mittineague

Technorati Tags: , ,

44 Comments

  1. Posted April 18, 2007 at 3:11 pm | Permalink

    version Beta 0.7.1 17-Apr-2007

    * added "Further Information" section

  2. Posted April 22, 2007 at 8:26 pm | Permalink

    If you have a WordPress blog, you may have noticed that the wp_options table has many "rss_hash" options. The older versions of this plugin did not get them because the get_alloptions function in fact only gets all options WHERE autoload = 'yes' and the rss options are autoload = 'no'.
    This version of the plugin now provides an easy way to remove them from the wp_options table too.

    version Beta 0.9.0 22-Apr-2007

    * added get_all "rss_" options
    * changed str_replace() to wordwrap()

  3. Josh
    Posted April 24, 2007 at 10:50 am | Permalink

    I think your plugin has great potential, the only problem that I'm having is not all of your SQL statements use the correct table name. For example, on line 326 you refer to the table as wp_options, although in my installation I chose to prefix my tables with wp1_ – which causes the plugin to fall. I would LOVE to use this – so please let me know if you make changes!

    Thanks!!!

  4. Posted April 24, 2007 at 12:49 pm | Permalink

    Thanks for the "heads up" Josh. I have made the change and updated the files in the plugin repository. The plugin should now work with blogs that don't have the default install database prefix.

    version Beta 0.9.1 24-Apr-2007

    * changed a 'hard-coded' wp_ to $wpdb->

  5. Posted April 25, 2007 at 3:55 pm | Permalink

    Even when one is cautious, accidents can happen. So I have added WP core options to the $known_ok array. This double-checking ensures that only options added by themes and plugins can be removed.

    version 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

  6. FabriceV
    Posted April 29, 2007 at 11:28 am | Permalink

    Really needed plugin… Currently a beginner, I test a lot of plugins… and would like to have the select all, unselect all buttons. I use it with "diagnosis" and "WP-DBManager" to create a overall WP admin tool.

  7. Posted July 4, 2007 at 3:30 am | Permalink

    here is what I get when I run your plugin:

    Fatal error: Out of memory (allocated 15990784) (tried to allocate 70383411 bytes) in /home/.maxine/jizz/h4x3d.com/wp-content/plugins/clean-options/cleanoptions.php on line 164

    I either have a crap hosting or way too many orphans in my database.
    is there a way to "only show the first 20 orphans" or something?
    thanks a lot for your time.

  8. Posted July 4, 2007 at 1:00 pm | Permalink

    jez, it sounds like you have lot's of orphans. The RSS cache database entries can be quite lengthy. I'll look into it when I get a chance and either post a patch here or incorporate it into the next version as a feature.

  9. Posted July 6, 2007 at 11:48 pm | Permalink

    It seems the main problem was the length of the file content string in non-PHP files. eg. database back-up "core" files. It should perform much better with the following changes:

    version Beta 0.9.3 06-Jul-2007

    * updated / improved WP core options array
    * provided for memory limit increase
    * optimized memory usage

  10. Posted July 27, 2007 at 2:12 am | Permalink

    Nice work, Very nice plugin!

  11. Posted August 12, 2007 at 12:52 pm | Permalink

    Hey,
    Great plugin.
    A select all/deselect all button would be nice.

  12. Posted August 29, 2007 at 9:59 am | Permalink

    vhostsit give me blank page with this:

    [Wed Aug 29 20:58:22 2007] [error] [client 222.124.158.189] PHP Fatal error: Cannot access empty property in /www/vhosts/dhani.web.id/dhani/oneko/wp-includes/functions.php on line 257, referer: http://dhani.web.id/oneko/wp-admin/edit.php?page=cleanoptions.php

  13. sk
    Posted October 2, 2007 at 2:19 am | Permalink

    any update for wordpress 2.3?

    its an amazing plugin, i was able to clean out so much

  14. Posted October 13, 2007 at 9:05 pm | Permalink

    WordPress ver. 2.3 has changes in the wp_options table.

    Beta 0.9.4 06-Oct-2007

    * added WordPress ver. 2.3 compatibility

  15. Posted October 14, 2007 at 3:08 pm | Permalink

    Hi, I'm using wordpress 2.2.3 and I'm having the next error message:
    "Fatal error: Cannot access empty property in /home/content/p/e/r/perraco/html/wp-includes/functions.php on line 283

  16. Posted October 17, 2007 at 5:41 pm | Permalink

    Still a bug with 2.3

    It is strongly suggested that you BACKUP your database before removing any options.

    WordPress database error: [Unknown column 'option_description' in 'field list']
    SELECT option_name, option_value, option_description FROM wp_options WHERE option_name = 'lca_thank_you'

  17. Sanchez
    Posted October 18, 2007 at 7:55 am | Permalink

    I'm having the same problem as Dhani, Cannot access empty property in…. I tried with both 2.2 and 2.3 versions.

  18. Posted October 18, 2007 at 12:08 pm | Permalink

    I have tried breaking the plugin in different ways, but have so far been unable to elicit the "Cannot access empty property" error. Please help solve this by joining the discussion in the forum (link is posted above).

    I attempted to fix the "Unknown column 'option_description'" error with Clean Options version 0.9.4 but I forgot to "scope" a variable. This error should be fixed in version 0.9.5

  19. Posted October 18, 2007 at 3:52 pm | Permalink

    Beta 0.9.5 18-Oct-2007

    * updated the $known_ok array
    * scoped $cur_wp_ver
    * removed $wpdb->hide_errors() from get_all_no_autoload_options()
    * changed WP_Error obj syntax
    * removed global $wp_queries from get_all_no_autoload_options()
    * replaced get_alloptions() with get_all_yes_autoload_options()

  20. Posted October 18, 2007 at 8:52 pm | Permalink

    Hi, I've got very good news! :))))
    I've installed the latest version and that I had the same bug, so I put my self into tweaking your code to hunt for the bug, AND I FOUND IT!!!!
    The problem is at 'foreach' loop starting at line 238, the code is fine but then I discovered that I had in the options table one record with an empty value on the option_name field, hence the code was failing, this is probably caused by other buggy plugins, who knows. The solution then is to check for options with empty names which although unveliable seems to happen, and to handle them accordingly. I hope to get a new version as soon as you fix it. By the way I still can't understand the RSS options, are they safe to delete?

    Regards

  21. Posted October 18, 2007 at 9:10 pm | Permalink

    More stuff, I checked with my fixed version that it reports the next two fields, but after installing a brand new version of wordpress for testing (the latest beta) I noticed that these fields are installed by wordpess so they shouldn't be reported, I believe. The fields are:
    use_trackback
    category_children

  22. Posted October 18, 2007 at 11:08 pm | Permalink

    Thanks Sanchez :)
    I will add an "if not empty" conditional to the next version and update the plugin repository ASAP.
    The category_children option is used in WordPress version 2.2.3 but is not used in version 2.3
    The use_trackback option is added by the schema, but dates back to WordPress version 1.5
    I'm inclined to believe that deleting these 2 options would probably be OK, but as I'm not 100% sure, I haven't done so myself. On the other hand, as they are not used by WordPress, I don't feel they belonged in the "known OK" array either. Hence the warning:

    Please review this information very carefully and only remove Options that you know for certain have been orphaned or deprecated.

    Why would WordPress still add the use_trackback option if it is a version 1.5 option?
    I imagine that it may be to maintain compatibility with any plugins that use it.

    I'll write a new post about the "rss_hash" options ASAP too.

  23. Posted October 19, 2007 at 5:28 pm | Permalink

    This version should resolve the empty option_name bug. Thanks for being patient and helpful.

    Beta 0.9.6 19-Oct-2007

    * added test for empty option_name field [autoload = yes block]
    * tweaked error handling

  24. Len
    Posted January 7, 2008 at 11:47 pm | Permalink

    Awesome plugin! However I agree with whoever said a "select all" option would be nice as I found over 300 entries! :)

  25. Dshe
    Posted January 8, 2008 at 1:08 am | Permalink

    A "Check All" option would be nice to clean all RSS hash trash…

  26. Posted May 22, 2008 at 1:09 am | Permalink

    I know this don't relate to anything Turkish, but how well does Clean Options work on the new wordpress 2.5 version? It appears you are still using 2.1 on this blog, did you ever test it?

  27. Posted May 23, 2008 at 11:00 pm | Permalink

    The Clean Options plugin has been tested and works with WordPress version 2.5

    However, although not critical as long as options are carefully reviewed before removal, the $known_ok array has to date only been checked against version 2.4

    I don't expect any problems with this, and I do plan to update the $known_ok array, as well as add a few enhancements, with the next release of the plugin.

  28. albert
    Posted June 22, 2008 at 12:19 am | Permalink

    Fatal error: Cannot access empty property in /wp-content/plugins/clean-options/cleanoptions.php on line 431

    WordPress 2.5.1

  29. Posted June 23, 2008 at 9:24 pm | Permalink

    The "Fatal error: Cannot access empty property in" error is most likely a result of an option that does not have an "option_name".
    $all_options->{$option->option_name} = apply_filters('pre_option_' . $option->option_name, $value);
    A similar problem was reported with the get_all_yes_autoload_options function and resolved in version 0.9.6
    I will add code to the get_all_no_autoload_options function in the next version of the plugin.

  30. Posted July 4, 2008 at 11:29 am | Permalink

    thanks for plugin

    perfect

  31. Posted July 19, 2008 at 2:26 am | Permalink

    can we download previous versions?

  32. Posted July 21, 2008 at 3:29 pm | Permalink

    Previous versions of the plugin can be found at http://wordpress.org/extend/plugins/clean-options/download/

  33. Posted August 5, 2008 at 12:51 am | Permalink

    Hi,

    Just wonder when this plug-in for WP 2.6 to be release?

    Thanks in advanced.

  34. Posted August 6, 2008 at 6:25 pm | Permalink

    The current version is compatible with WordPress version 2.6

    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]

  35. Posted September 19, 2008 at 9:22 pm | Permalink

    BTW why does WordPress need those rss_hash entries? WHy are they created and what's their purpose? Just wanted to know for knowledge.

  36. Posted September 20, 2008 at 4:18 pm | Permalink

    The rss_hash entries are created when WordPress caches a feed. This saves WordPress from needing to get the feed's content again.

  37. Posted October 30, 2008 at 8:59 am | Permalink

    I got this error message "Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 293986 bytes) in /home/xxxxxxx/public_html/wp-includes/functions.php on line 255" while I used this plugin. Got about 15 orphans then ended by the error message.

    This always happen since first install of the plugin. Re-install it didn't help.
    Beta 0.9.7 on WP 2.6.3. This even happen on WP 2.3.2.

    Any clues or quick fix?

    Thanks

  38. Adam Goldsztajn
    Posted November 17, 2008 at 2:43 am | Permalink

    fantastic plugin…frankly, i consider this one of the single best plugins available for WordPress…this wonderful little tool just removed over a 1MB of junk from my options table…(WordPress RSS blog ^&%&^!$#!) :) thank you!

  39. Posted November 20, 2008 at 2:24 am | Permalink

    Dhan, I imagine this is because your blog has an extreme number of "rss_hash" rows in the wp_options table. The current Release Candidate version of the plugin provides a way to "blind delete" ALL of the "rss_hash" rows thereby avoiding time and memory limit problems. Please see http://www.mittineague.com/blog/2008/11/clean-options-plugin-release-candidate/ for further information.

  40. Posted December 29, 2008 at 4:22 am | Permalink

    Clean Options's options how there is no "Select All",
    A check & a check to very tired~!!

  41. Posted December 29, 2008 at 4:43 am | Permalink

    It will catch, I was used themes atahualpa2,
    But atahualpa2 is not orphans Ah, I was using it,
    Cleand it, atahualpa2's color settings are changed back to the default.

  42. Posted January 4, 2009 at 10:01 pm | Permalink

    hi. what is problem ? wp 2.6.5. help me please

    Warning: Invalid argument supplied for foreach() in /home/content/t/u/r/site/html/blog/wp-content/plugins/clean-options/cleanoptions.php on line 290

  43. Posted January 15, 2009 at 2:23 pm | Permalink

    Warning: set_time_limit() has been disabled for security reasons in /home/a5717250/public_html/wp-content/plugins/clean-options/cleanoptions.php on line 157

  44. Posted January 27, 2009 at 8:59 pm | Permalink

    @taglife (and others)
    A javascript select/deslect all has been added to Clean Options 1.1.0 RC

    @baron
    I suspect this was because of the recursive directory search function returning the wrong data type (an object instead of an array). This has been fixed in Clean Options 1.1.0 RC

    @tj
    I have added safe_mode checking in Clean Options 1.1.0 RC

    Note* I have disabled further comments in this post. Please make comments in the Clean Options Plugin Release Candidate post.

    Thank you.

2 Trackbacks

  1. […] so bleibt meist (manchmal) ein Rest in der wp_options Tabelle, der somit meist zunimmt. Einfach das Clean Options PlugIn installieren und nachsehen, was für Müll so […]

  2. By Blogla ?lgili Güncellemeler » Vaveyla.Net on April 4, 2008 at 9:23 am

    […] önemli olan bu eklentilerin art?klar?n?n temizlenmesiydi. Onu da halletmi? oldum. Eklentiyi burdan […]