[wp-hackers] Plugin options being cleared on save

Scott Bressler sbressler at gmail.com
Mon Oct 18 17:13:50 UTC 2010


Thanks for the reply, John. Nope, I'm not - I was hoping that wasn't
necessary. Nacin also mentioned this - could either include as a hidden
field or re-add in the sanitization callback.

Thanks!

-Scott

On Mon, Oct 18, 2010 at 10:10 AM, John Blackbourn
<johnbillion+wp at gmail.com<johnbillion%2Bwp at gmail.com>
> wrote:

> Are you including the version number as a hidden field on the settings
> screen so it gets saved with the other options? The entire contents of
> the options field gets overwritten using the data that's submitted
> (ie. it doesn't just update the array keys that are submitted).
>
> John
>
> On Mon, Oct 18, 2010 at 5:46 PM, Scott Bressler <sbressler at gmail.com>
> wrote:
> > I'm saving a plugin's options into a serialized array. On plugin
> activation,
> > I insert a version number into the array, which properly appears when I
> > check the database. However, when I save the options that I added to the
> > "Writing" screen (using add_settings_section, add_settings_field, and
> > register_setting), which let the user change the other two settings in
> the
> > serialized array, the version number is removed from the array.
> >
> > Any idea why the version number is kicked out of the array on first save?
> >
> > Thanks!
> >
> > -Scott
>  > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list