[wp-trac] [WordPress Trac] #21488: Add Default Callback Functions for add_settings_field()

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 6 07:32:49 UTC 2012


#21488: Add Default Callback Functions for add_settings_field()
-------------------------+------------------------------
 Reporter:  mordauk      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by scribu):

 How about, instead of overloading the callback arg, you just skip it
 entirely and use a 'type' option instead? For example:

 {{{
 $args = array(
         'type' => 'select',
         'choices' => array(
                 'one' => 'The Choice Name',
                 'two' => 'The Second name',
                 'three' => 'The Third option'
         ),
         'description' => 'This is a dropdown.'
 );

 add_settings_field( 'pw_sample_option', 'A Sample Setting', false,
 'general', 'pw_sample_section', $args );
 }}}

 Starts to look a lot like Customizer fields, don't it?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21488#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list