[wp-hackers] Best practices for upgrading plugin options?

Steve Bruner [SlipFire] sbruner at slipfire.com
Thu Apr 28 20:50:39 UTC 2011


Hi Otto,

Maybe I'm not explaining correctly:

In v1.0 of plugin we have a simple default setting:
$default_setings = array( "setting1" => "This is some default text", "setting2"
=> "foo" )

The user chooses to delete the default text from their options,  so
"setting1" doesn't exist in the array anymore.

The user now upgrades to v2.0 of our plugin.  It has some more settings, and
I use wp_parse_args to merge the options.  Since "setting1" is empty, won't
wp_parse_args add the default text to the array? If yes, then this is the
issue since the user removed the default text.  This also happens when check
boxes are checked on default, and then unchecked by user.

Thanks
Steve


More information about the wp-hackers mailing list