[wp-hackers] Settings pages
Nathan Rice
ncrice at gmail.com
Fri Jun 12 15:33:09 GMT 2009
Ptah,
Using add_option is probably your best bet, as there is no theme activation
hook you'd be able to hook to (that I know of). And if you do it in such a
way that add_option is called only when the plugin/theme settings page is
loaded, you won't be adding any extra overhead to regular page loads.
Also, I'm not sure if you're serializing all your options into a single db
field, but if you are (and you should be) then you can do some magic with
wp_parse_args, or (like simon said) use the default parameter with
get_option to use defaults initially, until you can load the defaults into
the database.
Nathan
My Website
http://www.nathanrice.net/
My Twitter
http://twitter.com/nathanrice
On Thu, Jun 11, 2009 at 11:03 PM, Ptah Dunbar <pt at ptahd.com> wrote:
> If i'm creating an option using the register_setting API, is there a
> mechanism for giving it an initial value or should I just keep using
> add_option();?
>
> Ptah Dunbar — pt at ptahd.com
> http://ptahdunbar.com
>
>
> On Thu, Jun 11, 2009 at 9:59 AM, Simon Wheatley
> <simon at sweetinteraction.com>wrote:
>
> > On Thu, Jun 11, 2009 at 1:53 PM, scribu<scribu at gmail.com> wrote:
> > >
> > > Check the function add_settings_field()
> > >
> >
> > Between this and the register_settings function (Andrew describes it
> > here:
> >
> http://planetozh.com/blog/2009/05/handling-plugins-options-in-wordpress-28-with-register_setting/
> > )
> > I am absolutely made up. SO much easier to add and deal with settings!
> >
> > S
> >
> >
> > ---
> > Sweet Interaction Ltd is Registered in England/Wales, no. 6610741
> > Registered office: 7 Malton Av, Manchester, M21 8AT
> > _______________________________________________
> > 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