[wp-hackers] register_setting tip

Matt Freedman speedboxer at gmail.com
Mon May 4 23:27:46 GMT 2009


IIRC, name all the fields you want to be in one option
"ozh[something]", then just register the option as "ozh".

On Mon, May 4, 2009 at 8:09 AM, Ozh <ozh at planetozh.com> 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
>



-- 
Matt Freedman
Blog: http://mattsblog.ca/
Twitter: http://twitter.com/mattfreedman


More information about the wp-hackers mailing list