[wp-hackers] Best practices for plugin with complicated settings?

Ashish Saini ashishsainiashfame at gmail.com
Sun Jul 25 08:57:12 UTC 2010

What if I have multiple option pages for my single setting? Do I need to do
anything extra to take care of that?

Thanks & Regards
Ashish Saini aka Ashfame
(Deserve Before You Desire)
Homepage : http://www.ashfame.com | Blog : http://blog.ashfame.com | Twitter
: http://twitter.com/ashfame

On Sun, Jul 25, 2010 at 12:36 PM, Andrew Nacin <wp at andrewnacin.com> wrote:

> On Sun, Jul 25, 2010 at 2:49 AM, Anca Mosoiu <anca at anca.tv> wrote:
> >
> > Does the site settings table work the same way as post meta, where we can
> save
> > multiple values with the same key.
> Yep! And that's strongly encouraged in most situations. No serialization
> needed of course; WP handles that for you. WP handles a lot more than that
> actually, as you'll see with the settings API.
> You can use register_setting() to register a single setting for your
> plugin.
> Then make sure you have a sanitization callback that can verify that you're
> storing each of your sub-settings individually.
> For settings fields, you'd then use setting_name[option_a], etc... Then WP
> will receive an array of your options, pass it to the single sanitization
> callback, and eventually store it as a single row in the database.
> In your plugin, you can then make a single call to get_option() and you'll
> have everything you need as an array.
> (That said, if you're storing a good amount of data and you don't need all
> of it autoloaded, you *may* want to consider having two separate options,
> one autoloaded and one not. Then only loading the fat option when you need
> it.)
> Anyway, here's two good tutorials, one by Ozh and one by Otto. Both of
> these
> are linked from the Codex page:
> http://codex.wordpress.org/Settings_API
> http://ottodestruct.com/blog/2009/wordpress-settings-api-tutorial/
> http://planetozh.com/blog/2009/05/handling-plugins-options-in-wordpress-28-with-register_setting/
> _______________________________________________
> 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