[wp-hackers] register_setting tip

Ozh ozh at planetozh.com
Mon May 4 15:09:58 GMT 2009


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'); ?>" 
<input type="text" value="<?php echo get_option('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 ?


More information about the wp-hackers mailing list