[wp-hackers] Best practices for updating plugin options network-wide

Dino Termini dino at duechiacchiere.it
Thu Sep 8 14:40:37 UTC 2011


Hi, Otto,

thank you for your feedback. That is exactly what I'll do.

Dino

> Use add_site_option and get_site_option to store selected options
> globally, then merge the local options with the global ones when you
> load them.
>
> Assuming you use arrays of options, something like this would work:
>
> $options = wp_parse_args( get_option('my_options',array() ),
> get_site_option('my_options',array() ) );
>
> This way, if you have something in the sitewide array, it will be used
> as the default unless the local options exists, in which case it
> overrides it.
>
> -Otto



More information about the wp-hackers mailing list