[wp-hackers] mollom feedback (was: Spam plugin (was:Deprecated functions and files))

Otto otto at ottodestruct.com
Mon Aug 25 14:00:45 GMT 2008


On Mon, Aug 25, 2008 at 8:45 AM, Ozh <ozh at planetozh.com> wrote:
> - I personally hate when plugins add 15 rows in wp_options when one is
> enough. Instead of add_option('mollom_this',$molthis) and
> add_option('mollom_that',$molthat), why not
> add_option(array('mollom_this'=>$molthis,'mollom_that'=>$molthat))? Much
> cleaner on the DB.
> More on that: <
> http://striderweb.com/nerdaphernalia/2008/07/consolidate-options-with-arrays/>

I'm not a huge fan of this approach. While it makes sense in specific
cases where you need all the options all the time, for some of the
more complex plugins, where you only need some of the options at some
times, it makes more sense to separate them out.

What's more, consolidating the options into arrays doesn't really buy
you anything (except easy cleanup) *if* you use the autoload parameter
correctly. Calling get_option a dozen times results in no extra
database hits whatsoever, if you have those options set to autoload.
Because then they're already in the object cache.

What bugs me more is that most plugins use add_option or update_option
without specifying "no" for the autoload parameter (which defaults to
yes), even though they don't need their option to load on every page.


More information about the wp-hackers mailing list