[wp-hackers] Theme Options as serialized Array

Jeremy Clarke jer at simianuprising.com
Tue May 25 13:33:10 UTC 2010

On Mon, May 24, 2010 at 10:17 PM, 24/7 <24-7 at gmx.net> wrote:
> i'm trying to add options for a theme as a serialized array. Adding
> these options (the first time via add_option) works fine, but i got
> problems with updating the array. When i looked at several tutorials i
> found out that most people use the settings API to update the array.
> But at the codex i saw that get_settings is depraceted and replaced by
> get_option. Is there some connetion between the settings API and
> get_settings, or, to say it in other words: Is the settings API
> depracated too, and is there another (maybe better) way?

Like Mike said you can just use the basic update and get options to
save settings in the database using your own submission-handling
logic. You can pass update_option() and get_option() arrays or objects
and expect serialization to be automated.

The "Settings API" refers to a separate but related system used to
automate the process of creating a settings page for your plugin. It
lets you define your settings using functions, then handles updating
the data for you. It takes some time to get used to be leaves you with
a very organized settings page and avoids a lot of bugs caused by
writing the updating logic yourself.

Mediocre Codex Article: http://codex.wordpress.org/Settings_API
Otto wrote a great tutorial:

Jeremy Clarke | http://jeremyclarke.org
Code and Design | http://globalvoicesonline.org

More information about the wp-hackers mailing list