« Return to Thread: Settings pages

Re: Settings pages

by Simon Wheatley-3 :: Rate this Message:

Reply to Author | View in Thread

n Fri, Jun 12, 2009 at 4:03 AM, Ptah Dunbar<pt@...> 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();?
>

I'd be interested in how others do this, I run something similar to
the following on plugin activation:

// Get the option (returns a default if it doesn't exist)
$value = get_option( $name, $some_default_value );
// Then set the option value in case it didn't exist
update_option( $name, $value );

Hope this helps.

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@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

 « Return to Thread: Settings pages