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

Andrew Nacin wp at andrewnacin.com
Sun Jul 25 09:06:35 UTC 2010


On Sun, Jul 25, 2010 at 4:57 AM, Ashish Saini
<ashishsainiashfame at gmail.com>wrote:

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

The way I'd do it is as follows:
 - Register the setting multiple times, for each option group (page).
 - In the sanitization callback(s), make sure you account for other indices
that may be stored but not accounted for on that page save. You can call
get_option() for example and make sure you keep the original indices you
want, and then replace the ones you're updating for that page.

Regardless, heavy whitelisting and sanitization is critical to ensure
stability and security.


More information about the wp-hackers mailing list