[wp-hackers] register_setting tip

Mike Schinkel mikeschinkel at newclarity.net
Mon May 4 22:17:35 GMT 2009


Ozh,

Is the trick to create a sanitize function that would do the  
management of the setting for you, maybe?

-Mike Schinkel
WordPress Custom Plugins
http://mikeschinkel.com/custom-wordpress-plugins/




On May 4, 2009, at 11:09 AM, Ozh wrote:

> Peeps,
>
> I'm pretty sure this has been answered already and I'll probably  
> commit
> sepukku when I get the answer, but I can't recall it.
>
> With, on init :
> register_setting('ozh-options', 'ozh-1', 'intval');
> register_setting('ozh-options', 'ozh-2', 'intval');
>
> And then on the admin form:
> <?php settings_fields('ozh-options'); ?>
> <input type="text" value="<?php echo get_option('ozh-1'); ?>"
> name="ozh-1"/>
> <input type="text" value="<?php echo get_option('ozh-2'); ?>"
> name="ozh-2"/>
>
> You end up with one DB entry for each option.
>
> What's the trick again to store everything in one entry, using the new
> register_setting API ?
>
> Ozh
>
> _______________________________________________
> 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