[wp-hackers] How do you store multiple plugin options
Mike Schinkel
mikeschinkel at newclarity.net
Tue Mar 23 23:47:11 UTC 2010
On Mar 23, 2010, at 7:36 PM, scribu wrote:
> There's no point in storing default widget options (that never change) in
> the wp_options table.
>
> Just leave them in the code:
>
> function widget($instance) {
> $defaults = array('
> key => value
> ...
> );
>
> $instance = array_merge($defaults, $instance);
> }
+1. Defaults stored in code are much less fragile and it becomes much better documentation.
Also, similarly, it sure would be nice if there was a standard way for plugins to on-demand persist their option state to code so that people who develop and deliver a site can include said code to reinitializes all plugins from a default install. It would make deploying developed WordPress solutions easier and would make reinitializing WordPress solutions during development much easier. Thoughts on this?
-Mike
More information about the wp-hackers
mailing list