[wp-hackers] Plugin options being cleared on save

John Blackbourn johnbillion+wp at gmail.com
Mon Oct 18 17:10:37 UTC 2010


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
>


More information about the wp-hackers mailing list