Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In this tutorial about how to create a settings page, the author creates a select element with style display:none.

<li class="front-page-element" id="front-page-element-placeholder"   
    <label for="element-page-id">Featured post:</label>  
    <select name="element-page-id">  
        <?php foreach ($posts as $post) : ?>  
            <option value="<?php echo $post->ID; ?>">  
                <?php echo $post->post_title; ?>  
        <?php endforeach; ?>  
    <a href="#">Remove</a>  

Than he lets the user append as much fields as he wants with jquery. I want to use the settings API, because many people consider this better practice. With settings API setting fields are created this way:

if ( $active_tab == 'general' ) {
    settings_fields( 'nothing_settings_general' );
    do_settings_sections( 'nothing_settings_general' );

I still want to have an "Add field" button. Can I add an option to a settings field on-the-fly and how?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.